954,551 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Wait/Pause Application before next process.

The application I am writing involves creating a dos batch file and executing it using the 'Shell' command.

The batch file is used to zip up multiple files.

The zip file that is created is them emailed.

:?: My problem is - creating a pause within the application so the zip file can be created. I have tried a simple pause (for t=1 to 100000: next t). I know this isnt the best way to do it.

:!: The zip file could take between 0.5 to 30 seconds to create.

Any help would be great.
Cheers
PG

purplegerbil
Junior Poster in Training
78 posts since Apr 2005
Reputation Points: 24
Solved Threads: 6
 

Are You trying to make the batch file pause, or the VB Program wait until the batch file is done? If you are trying to wait until the batch file is done, don't use shell. (you can use shell, but it's a lot more code than this here). Use WSH within VB, as such:

dim wsh
set wsh = createobject("WScript.Shell")
wsh.Run "c:\somebatchfile.bat", 0, 1
Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

Hi,
Whats the ,0,1 used for?

purplegerbil
Junior Poster in Training
78 posts since Apr 2005
Reputation Points: 24
Solved Threads: 6
 

0, makes it hide the window, so that it doesn't show up to the user (otherwise, they'd get some stupid dos window).
1, makes the Run Method of the WSH Object wait until the spawning process completes, before continuing on.

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

Works like a dream.

Thanks

purplegerbil
Junior Poster in Training
78 posts since Apr 2005
Reputation Points: 24
Solved Threads: 6
 

;) Good Stuff.

Comatose
Taboo Programmer
Team Colleague
2,910 posts since Dec 2004
Reputation Points: 361
Solved Threads: 215
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You