
Newbie needs help (making scripts wait for apps to end)
Try this. Use the Wait On Return option in your Run method. Set it to True
(False is default). Your script should not continue until you exit your
app.
Put the following code in a file and try it. You should not get the message
box until after you close Notepad.
Set WshShell = WScript.CreateObject("WScript.Shell")
Return = WshShell.Run("notepad " & WScript.ScriptFullName, 1, TRUE)
WScript.Echo "end"
Quote:
> I need to get a script to engage a program and wait until a program is
> finished before continuing on with the other script commands. The run
> method doesn't seem right nor does the sleep one. Here's the script as it
> currently exists. I use the sleep method now but I have know idea how
long
> some tasks might take.
> set objWshShell = WScript.CreateObject("WScript.Shell")
> objWshShell.Run("c:\progra~1\access~1\backup\msbackup")
> Wscript.sleep 3000
> objWshShell.Sendkeys "%S"
> Wscript.sleep 20*1000
> ObjWshShell.Sendkeys "~"
> Wscript.sleep 1000
> ObjWshShell.Sendkeys "~"
> Wscript.sleep 1000
> ObjWshShell.SendKeys "%JX"
> Set objWshShell = Nothing