|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| ||||||||||||||||||||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
||||
|
||||
|
Do While FileExists = False
Ive wrote some vbscript to download a file from ftp through the command shell, but the problem is the rest of my code is executing before the file is downloaded.
What im trying to do is make the script wait for the file to be downloaded before the rest of the script is executed, Heres what ive tried but it doesnt seem to work. Code:
set fs=CreateObject("Scripting.FileSystemObject")
'Wait while File Downloads 3 Minutes At MOST
numSeconds = 80
counter = 0
starttime = now()
Do While fs.FileExists("C:\file.txt") = false
'Exit if Download takes longer than 3 Minutes
if DateDiff("s", starttime, endtime) = numSeconds then exit do
Loop
So the idea is that the loop keeps looping and waiting until the file is found before moving on. Any help is appreciated. Thanks
__________________
That's 'cause droids don't pull people's arms out of their sockets when they lose. Wookies are known to do that. |
|
#2
|
|||
|
|||
|
One idea would be to put the code that retrieves the ftp file behind a form that you call to open in Dialog mode. Pass the search criteria to the form and have the retrieve code execute in the form open event. The code that follows the open form command will not execute until the form closes. Then the trick is how to detect that the download is complete and close the form. Here are links to code for ftp upload/download (Google 'vb download ftp')
http://www.vb-helper.com/howto_ftp.html http://vbnet.mvps.org/index.html?co...ftpdownload.htm Maybe just putting the retrieve code in a subroutine will suffice and the form would not be needed. I have not analyzed the code on these links so can't really say. Last edited by June7 : October 30th, 2009 at 03:58 PM. |
![]() |
| Viewing: ASP Free Forums > Programming > Visual Basic Programming > Do While FileExists = False |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|
|