Start /Wait

B

Barney

I have a shell script that (loosely speaking) calls a WSH
script (CleanupHTML.vbs) whose contents I have not posted
because I don't think they matter.

An excerpt from my shell script is as follows:

..
..
..
START "HTML Cleanup" /WAIT CleanupHTML.vbs
PING 127.0.0.1 -n 31 -w 1 >NUL
..
..
..

The problem is: The first shell script is not waiting for
CleanupHTML.vbs to complete before executing the
statements after it. I have added the PING command to
create a 30 second delay to allow the vbs script to
finish. I also tried to CALL the vbs file but this did
not work either. My workaround using PING is working but
I am curious to know why START /WAIT is not.
 
R

Ritchie

Barney said:
I have a shell script that (loosely speaking) calls a WSH
script (CleanupHTML.vbs) whose contents I have not posted
because I don't think they matter.

Does "CleanupHTML.vbs" start any processes?
 
R

Ritchie

Barney said:
Yes, it uses Notepad to open an HTML file. It then uses a
bunch of SendKey statements before saving the file and
closing.

Then I ~think~ the vbs file might be relevant, can you post it?
 
G

Guest

Sure. Here it is.

Const MAXIMIZE_WINDOW = 3
Set objShell = WScript.CreateObject("WScript.Shell")
objShell.Run "Notepad.exe C:\Data\MyFile.htm",
MAXIMIZE_WINDOW
Do Until Success = True
Success = objShell.AppActivate("Notepad")
Wscript.Sleep 400
Loop
objShell.SendKeys "%ER"
Wscript.Sleep 400
objShell.SendKeys "%N"
Wscript.Sleep 400
objShell.SendKeys "<a href"
objShell.SendKeys "%P"
Wscript.Sleep 400
objShell.SendKeys "<href"
Wscript.Sleep 400
objShell.SendKeys "%A"
Wscript.Sleep 400
objShell.SendKeys "{Esc}"
Wscript.Sleep 400
objShell.SendKeys "%EF"
Wscript.Sleep 400
objShell.SendKeys "</table></table>"
Wscript.Sleep 400
objShell.SendKeys "%F"
Wscript.Sleep 400
objShell.SendKeys "{Esc}"
Wscript.Sleep 400
objShell.SendKeys "{Down}"
Wscript.Sleep 400
objShell.SendKeys "{Left 15}"
Wscript.Sleep 400
objShell.SendKeys "+^{End}"
Wscript.Sleep 400
objShell.SendKeys "{Del}"
Wscript.Sleep 400
objShell.SendKeys "%FS"
Wscript.Sleep 400
objShell.SendKeys "%FX"
-----Original Message-----
"Barney" <[email protected]> wrote in
message news:[email protected]...
 
T

Torgeir Bakken (MVP)

Sure. Here it is.

(snip)

I can run your vbscript code from a batch file with

START "HTML Cleanup" /WAIT CleanupHTML.vbs

and it waits for the vbscript to finish before continuing...
 
R

Ritchie

Ditto Torgeir.
How about trying:-

START "HTML Cleanup" /WAIT cscript CleanupHTML.vbs

or

START "HTML Cleanup" /WAIT wscript CleanupHTML.vbs
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top