Want to understand why this doesn't work right, please
- From: Ed from AZ <prof_ofwhat@xxxxxxxxx>
- Date: Thu, 5 Feb 2009 06:32:37 -0800 (PST)
I cobbled together a very basic script to run a program, sleep, run
the program again, and Echo "I'm done". Real simple:
Dim a wshell object
wshell.Run Command line
Sleep
wshell.Run Command line
wscript.Echo "I'm done"
The program does launch and run as desired. I had too long of a sleep
time at first and thought the script was done, then it suddenly
launched again! That's when I decided to cut the sleep time and put
in the Echo to tell me when the script is completed.
I think I'm missing some pretty basic understanding, though. I ran
the script, the program launched, and I got my message box before the
program finished. The program did not launch a second time. That was
not the behavior I expected! I thought the program would run and
close, THEN sleep, run and close again, THEN echo.
So I suspect the Run launches the program in a process thread totally
independant of the script? So it does the Run line and immediately
does the Sleep time? And if the program is still running by the time
Sleep is over, it may launch a second instance or it may see the first
instance still running and pass on it, and then immediately Echo?
If this is the case, is there any way I can delay the progression from
Run to Sleep and Run to Echo until the program is finished and closes
by itself?
Ed
.
- Follow-Ups:
- Re: Want to understand why this doesn't work right, please
- From: ekkehard.horner
- Re: Want to understand why this doesn't work right, please
- Prev by Date: Call sub in Excel ThisWorkbook module from VBS
- Next by Date: Re: Want to understand why this doesn't work right, please
- Previous by thread: Call sub in Excel ThisWorkbook module from VBS
- Next by thread: Re: Want to understand why this doesn't work right, please
- Index(es):
Relevant Pages
|