Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Trouble with a Do While loop

Status
Not open for further replies.

cold25

Programmer
Feb 11, 2002
41
0
0
US
I have attempted to include a simple Do While Not loop. It's supposed to keep checking for a modal screent to pop up, until the screen pops up, and then move on. However, the line Do While Not WshShell.AppActivate "HP Scan Picture" keeps causing an error stating "Expected statement." I'm not sure what's wrong and would appreciate any suggestions. Thanks.
cold25

'Enter the script code.
Set WshShell = CreateObject("WScript.Shell")

'Call program to launch
WshShell.Run """C:\Program Files\Hewlett-Packard\Digital Imaging\bin\Hpqdirec.exe"""

WScript.sleep 4000

WshShell.AppActivate "HP Director"
WshShell.SendKeys "%{p}" 'Execute the first scan.
WshShell.SendKeys "~"

'Wait for modal screen to choose scan or done.
Do While Not WshShell.AppActivate "HP Scan Picture" '<- Causes an error saying "Expected statement."

WshShell.AppActivate "HP Scan Picture"
Loop

'Do more stuff after HP Scan Picture screen has become the active screen.
WshShell.SendKeys "~"
 
You may try this:
'Wait for modal screen to choose scan or done.
Do Until WshShell.AppActivate("HP Scan Picture")
WScript.Sleep 1000
Loop


Hope This Helps, PH.
Want to get great answers to your Tek-Tips questions? Have a look at FAQ219-2884 or FAQ222-2244
 
It worked! Thank you again, PHV. Your suggestion was once again a great help. Thanks!
cold25

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top