PDA

Click to See Complete Forum and Search --> : do you know this ---please help---


Jan 4th, 2001, 07:44 PM
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: sam@vbsquare.com
'- 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

Jan 5th, 2001, 01:56 PM
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