Results 1 to 9 of 9

Thread: PLEASE HELP ME!!!!!!!

  1. #1
    Guest
    how can i make this script pause in between downloads

    it keeps skipping the first strurl and going to the second

    here is my complete code just in case something has to be done below





    '----------------------------------------
    '- Name: Sam Huggill
    '- Email: [email protected]
    '- Web: http;//www.vbsuare.com/
    '- Company: Lighthouse Internet Solutions
    '- Date/Time: 13/11/99 21:33:23
    '----------------------------------------
    '- Notes:
    '
    '----------------------------------------

    Option Explicit

    Private Sub cmdAbout_Click()
    frmAbout.Show vbModal
    End Sub



    Private Sub cmdGetPage_Click()
    Inet1.AccessType = icUseDefault
    Dim b() As Byte
    Dim strURL As String

    ' Presuming this is still a valid URL.
    strURL = "http://msdn.microsoft.com/library/devprods/vs6/vbasic/vb98/vbmsgldBadVBXVersion.htm"

    strURL = "http://msdn.microsoft.com/library/welcome/dsmsdn/msdn1.htm"

    ' Retrieve the file as a byte array.
    Inet1.Cancel
    b() = Inet1.OpenURL(strURL, icByteArray)

    Dim fName

    fName = Split(strURL, "/")
    'fName (UBound(fName))

    Open "c:\" & fName(UBound(fName)) For Binary Access _
    Write As #1
    Put #1, , b()
    Close #1

    'MsgBox "Done"
    End Sub

    Private Sub Inet1_StateChanged(ByVal State As Integer)
    Select Case State

    Case icConnected
    SetStatus "Connected"

    Case icConnecting
    SetStatus "Connecting"

    Case icDisconnected
    SetStatus "Disconnected"

    Case icDisconnecting
    SetStatus "Disconnecting"

    Case icError
    SetStatus "Error: " & Inet1.ResponseInfo, True

    Case icReceivingResponse
    SetStatus "Receiving response"

    Case icRequesting
    SetStatus "Requesting"

    Case icRequestSent
    SetStatus "Request Sent"

    Case icResolvingHost
    SetStatus "Resolving host"

    Case icResponseCompleted
    SetStatus "Response completed"

    Case icResponseReceived
    SetStatus "Response received"

    End Select
    End Sub

    Private Sub SetStatus(strMsg As String, Optional blnErr As Boolean = False)

    If (blnErr = True) Then
    lblStatus.ForeColor = vbRed
    Else
    lblStatus.ForeColor = vbBlack
    End If

    lblStatus = strMsg

    End Sub






    thank you in advance

  2. #2
    Addicted Member jcouture100's Avatar
    Join Date
    Aug 1999
    Posts
    141
    It's a real easy answer... Look at your cmdGetPage_Click subroutine. Notice that you set strURL equal to one string and then immediately set strURL equal to another. The first URL never gets executed. You need to set strURL to the first value, run your code, then set strURL to the next value and do it again.

    Hope this helps.

    JC.

    Code:
    Private Sub cmdGetPage_Click()
        Inet1.AccessType = icUseDefault
        Dim b() As Byte
        Dim strURL As String
    
        '******* NOTE ******
        'This strURL never gets used because it is immediately overwritten with the second string.
        strURL = "http://msdn.microsoft.com/library/devprods/vs6/vbasic/vb98/vbmsgldBadVBXVersion.htm"
    
        strURL = "http://msdn.microsoft.com/library/welcome/dsmsdn/msdn1.htm"
    
        ' Retrieve the file as a byte array.
        Inet1.Cancel
        b() = Inet1.OpenURL(strURL, icByteArray)
        
        Dim fName
        
        fName = Split(strURL, "/")
        'fName (UBound(fName))
        
        Open "c:\" & fName(UBound(fName)) For Binary Access _
        Write As #1
        Put #1, , b()
        Close #1
        
        'MsgBox "Done"
    End Sub
    JC

  3. #3
    Guest

    how

    how do i do that

    i am new to this

    hell this took me three days and a lot of hrs just to get this far

    could you explain what you mean and how or what i need to change

    i am trying to download about 3000 pages so i really need to get past this

    thanks
    chris

    i thank you
    for pointing this BIG (small )problem out for me at least i know something now as to why its not working right

  4. #4
    Guest
    anyone know how to do this


    It's a real easy answer... Look at your cmdGetPage_Click subroutine. Notice that you set strURL equal to one string and then immediately set strURL equal to another. The first URL never gets executed. You need to set strURL to the first value, run your code, then set strURL to the next value and do it again.


  5. #5
    Fanatic Member Wen Lie's Avatar
    Join Date
    Jul 1999
    Location
    Singapore
    Posts
    524

    Talking

    Well,

    I think JC is right. You can't put the two URL String at the same place, before you process one of them...

    I mean...
    You could put one URL String first and then process it, then, after that, put the second one and process it.

    Quite simple, right ?

    I hope the clue below will help... and you should correct the clue below more, don't just use it... coz, I only show the clue... :

    Code:
    Private Sub cmdGetPage_Click()
        Dim strURL As String
    
        strURL = "http://msdn.microsoft.com/library/devprods/vs6/vbasic/vb98/vbmsgldBadVBXVersion.htm"
    
        Call WriteFile(strURL)
    
        strURL = "http://msdn.microsoft.com/library/welcome/dsmsdn/msdn1.htm"
        Call WriteFile(strURL)
    End Sub
    
    Private Sub WriteFile(URLstr as String)
        Inet1.AccessType = icUseDefault
        Dim b() As Byte
    
        ' Retrieve the file as a byte array.
        Inet1.Cancel
        b() = Inet1.OpenURL(URLstr, icByteArray)
        
        Dim fName
        
        fName = Split(URLstr, "/")
        'fName (UBound(fName))
        
        Open "c:\" & fName(UBound(fName)) For Binary Access _
        Write As #1
        Put #1, , b()
        Close #1
    End Sub
    help ???

    Wille
    Regards,
    [-w-]

  6. #6
    Guest

    Wink

    Add a

    msgbox strURL
    after
    strURL = "http://msdn.microsoft.com/library/welcome/dsmsdn/msdn1.htm"

    you would understand why it is skipping the first URL

    coz
    whatever value is with strURL gets executed




  7. #7
    Guest

    Thumbs up

    THANK YOU FOR ALL OF YOUR HELP


    I went on a mad hunt to try to fix this and it was that easy

    at first i was mad cause ya just did not type point blank and say here instead of a clue

    but now that it works

    thanks for the clue it made me think about what it was really doing and it was so simple its unreal and i missed it



    well its alwasy under your nose u look least


    thanks again

    to all

    chris


  8. #8
    Fanatic Member Wen Lie's Avatar
    Join Date
    Jul 1999
    Location
    Singapore
    Posts
    524

    Talking

    The clue works ???
    Hmm.... Thx God then...
    I don't even know whether it will works or not...
    But, I'm sure with a little bit changes, my clue will work.... And you've proved it...

    Congratulations then...
    and don't be mad... Coz, I can't show you the real code, since I have my own project, and the dateline is so closed... So, I only can show you the clue with hope that you can fix it better....



    Cheers,
    Wille
    Regards,
    [-w-]

  9. #9
    Guest

    Thumbs up

    yes it worked with a mod but i would like to pull the urls from a text file maybe

    i mean there is about 9000 urls that i download with this script

    of course i had to do it about

    2000 at a time

    it kept telling me the app was to big

    i think i read that a string can only have 2 million chars

    so i guess i went over that or maybe its thr resourcs on my computer

    who knows i dont

    if u like i could post the script if u would like to see my mod on it

    well in any case thanks for THE CLUE

    it works
    and i am not mad at u

    i am mad at ME for not thinking it throgh


    well any ways thanks again

    what kind of project are ya working on

    or is top sec like the CLUE

    lol


    thanks again for all your help



    chris
    --------------------------------------------------------
    THE CLUE IS GOOD, THE CLUE WORKS, THANK GOD FOR THE CLUE

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width