I'm running a simple script that:
- Launches an app
- AppActivates the app (using a loop until it is loaded)
- sleep for a second
- then sends keystrokes to the application.
Here's the code:
Set objShell = WScript.CreateObject("WScript.Shell")
cnt=1
Do Until Success = True
Success = objShell.AppActivate("My App")
wscript.sleep 250
cnt=cnt+1
if cnt>40 then
Success = True
end if
Loop
if cnt>40 then
msgbox "App did not launch within 10 seconds"
else
Wscript.Sleep 300
objShell.SendKeys "somekeystrokes{ENTER}"
end if
The problem is that somehow the application is getting hung up with
the script. As long as the script is running, the application is
non-responsive. It will launch...but then it freezes and the screen
doesn't completely draw. As soon as the script errors out and I close
it...the app comes alive.
I'm assuming that the app and wscript.exe are running in the same
memory space and are interfering with each other. Is there a way to
run the script in its own memory space so it will not interfere with
the app.
Or is there another problem that I'm missing?
Thanks for any advice,
Walt