Newbie needs help (making scripts wait for apps to end) 
Author Message
 Newbie needs help (making scripts wait for apps to end)

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



Sun, 30 Dec 2001 03:00:00 GMT  
 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



Mon, 31 Dec 2001 03:00:00 GMT  
 Newbie needs help (making scripts wait for apps to end)
Thanks for the help, but it didn't work.

I need the script to begin the backup (got this), send some keys (got this),
wait for the app to finish (don't got this), and send some more keys (got
this).

This all needs to be done unattended.  The WaitOnReturn doesn't fit that
need as far as I can tell.

Any other suggestions?  I have tied to have the first script call another to
finish the operation but timing is still an issue.



Mon, 31 Dec 2001 03:00:00 GMT  
 
 [ 3 post ] 

 Relevant Pages 

1. Making the system wait for a script

2. Making a Script Wait for events

3. Newbie : Need to automatically install an app

4. Newbie needing help with VBS Scripting

5. Newbie needs ActiveX and VB Script help....

6. Please, Need help with windows script - newbie

7. Newbie needs help, clueless about scripting

8. newbie at wits end - please help simple problem

9. Newbie Need help with Script

10. Newbie needs help scripting outlook to send a message

11. Please, Need help with windows script - newbie

12. Newbie help needed with a Logon Script

 

 
Powered by phpBB® Forum Software