Results 1 to 2 of 2

Thread: do you know this ---please help---

  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
    Guest
    You need to change the names of your variables. You are using the same variable name over.

    strURL = "http://msdn.microsoft.com/library/devprods/vs6/vbasic/vb98/vbmsgldBadVBXVersion.htm"

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


    strURL will always be "http://msdn.microsoft.com/library/welcome/dsmsdn/msdn1.htm"

    I suggest using an array to store your URL's:

    Dim strURL(2) as string
    Dim intLoop as single

    strURL(1)= "http://msdn.microsoft.com/library/devprods/vs6/vbasic/vb98/vbmsgldBadVBXVersion.htm"

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

    For intLoop = 1 to UBOUND(strURL)
    ' Retrieve the file as a byte array.
    Inet1.Cancel
    b() = Inet1.OpenURL(strURL(intLoop), icByteArray)

    Dim fName

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

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


    Next intLoop

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