|
-
Jan 4th, 2001, 08:51 PM
#1
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
-
Jan 4th, 2001, 09:33 PM
#2
Addicted Member
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
-
Jan 4th, 2001, 10:52 PM
#3
-
Jan 4th, 2001, 11:58 PM
#4
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.
-
Jan 5th, 2001, 12:06 AM
#5
Fanatic Member
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
-
Jan 5th, 2001, 12:09 AM
#6
-
Jan 5th, 2001, 12:38 AM
#7
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
-
Jan 5th, 2001, 02:16 AM
#8
-
Jan 5th, 2001, 04:56 AM
#9
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
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|