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.
 
Ad

Advertisements

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?
 
B

Barney

Yes, it uses Notepad to open an HTML file. It then uses a
bunch of SendKey statements before saving the file and
closing.
-----Original Message-----
"Barney" <anonymous@discussions.microsoft.com> wrote in
message news:077401c3a99e$980f91f0$a401280a@phx.gbl...
 
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" <anonymous@discussions.microsoft.com> wrote in
message news:044501c3a9d8$3c574c10$a001280a@phx.gbl...
 
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...
 
Ad

Advertisements

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

Top