Xrunandwait not waiting for app to close

批注 2020-05-28 185519
Please check my marco, calc.exe started and didnt close, but macro still ended
Anyone can help me with this? Thank you in advance!

I confirmed this. This can happen. Some apps (like the new Windows 10 calculator) actually return an exit code after they are started.

In general we recommend to use XRun or XRunAndWait “only” to start another scripting language like Batch files, Bash, PowerShell, Python or VBS, and then use these scripting languages to start other application programs like Adobe Photoshop, Skype, Word or Zoom.

The reason is that all these apps behave differently at startup depending how they are developed. But even the full-grown scripting languages like Powershell or Python can sometimes not tell if an app was started and/or is already closed. In this case the solution is to use the computer vision features of UIvision:

How to wait for an app to start?

If you want to check of an app is already started, and/or is already closed use the computer vision visualAssert command:

visualAssert |calcexe

=> This waits for the app to start.

See also: If {picture} then {do this}

1 Like

Thanks for replying.
I tried batch file and it works fine.

1 Like