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 "~"
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 "~"