I have a scenario where I'd like 2 separate applescripts.
The idea is super simple. 2 Applications, but only one runs at a time.
Example: Close application 1, launch application 2 (and vise versa)
Here are the 2 scripts I have:
A.) OpenSteam
tell application "Plex Home Theater" to quit
delay 5
tell application "Steam" to activate
B.) OpenPlex:
tell application "Steam" to quit
delay 5
tell application "Plex Home Theater" to activate
The script "OpenSteam" works perfectly fine. It does exactly what I want it to do. However, the same script in reverse (OpenPlex) does not seem to work.
Steam closes, but my script then gives me the following error *Note, Plex is not launched:
error "Steam got an error: User canceled." number -128
I have no idea what this means, and was hoping someone could help me out.
—
I got my initial information from here: https://forums.plex.tv/index.php/topic/27945-harmony-one-custom-command/#entry179765 I have revised the example scripts to fit my needs.
Best Answer
Your headache lays with how Steam handles its exit status. Steam probably doesn't have applescript integration, so it considers a
quit
command from applescript an unclean exit. It would still quit, but it will let you know about it. What you need is a way to ignore the error message and execute the rest of the script nevertheless.You can combine the two scripts into one toggle/switch:
I don't have either app so I cannot debug. There could be multiple processes named "steam", given its game-thing, so I used "Steam.app", assuming that's the app name under
/Applications/
.