Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Pause system while file downloads

Status
Not open for further replies.

AvGuy

Programmer
Jan 8, 2003
126
US
Using Access97 I want to pause code in an event procedure until a file downloads from the net. I'm using the FollowHyperlink method to access a zip file. After it downloads I can use Shell/Wait to unzip the file, but need a method to pause the code during the actual download procedure. I'm experimenting with DoEvents and with OnTimer routine, but haven't found a way to make it work yet.

Any tips?

AvGuy
 
I would create a Do while loop with a check if the file exists already and then set a flag when the file is there.

something like this:

Dim flag

flag = "N"

Do while flag = "N"
if Dir<filename> <> &quot;&quot; Then
flag = &quot;Y&quot;
end if
Loop
 
I say it is *essential* that inside the loop you put a &quot;DoEvents&quot; line. This will keep your system responsive to mouse movements and the like, instead of (seemingly) locking up your computer.

But essentially, do the above loop with some sort of flag that you can check.
 
Thanks. I had pretty much worked this out since posting the query. However, this process won't work perfectly if using a self-extracting WinZip file because extraction occurs under the DoEvents umbrella which masks the check for the .exe file. In other words, if checking for an .exe file, the process will miss it because it disappears almost instantly since the file name changes as the first step of extraction. By including both the exe and the extracted file names in the conditional the process seems to work, viz:

Dim Flag As Boolean
Flag = False
Do While Flag = False
DoEvents
If Len(Dir({Path & File with .exe} > 0 OR Len(Dir({Path & file with .mdb}) > 0 then
Flag = True
End If
Loop
x = ShellWait({Path & file with .exe})

Just make sure you kill these names in the target folder before running the routine.

Cheers
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top