Disclaimer: I’m no expert when it comes to AS, not even a newbie, so I hope someone can still help me with this…
I use Keyboard Maestro and for some reason the engine crashes and my macros stop working until I restart the engine. I found the following script that gets triggered when the engine crashes, showing me a notification, which is already a great thing:
repeat
tell application "System Events"
if name of every process does not contain "Keyboard Maestro Engine" then display alert "Keyboard Maestro Engine quit!"
end tell
delay 5
end repeat
Now what I would like to have, instead of just the notification, would be the same popup, but instead of the OK button, I could have a button that automatically launches the engine. Can this be done?
So basically, where it says “display alert”, I would have something else that would show me the pop up with the “Launch KM Engine” button and would launch it, so I don’t have to go and launch it manually by going to the folder that contains it.
Thank you for the reply.
Maybe I wasn’t clear about what I need…
The issue now is not whether I’m using Keyboard Maestro or any other app, and it’s not about the errors. My goal is to have a script that instead of showing a notification window with an OK button (then I have to go launch Keyboard Maestro Engine manually), I would like to have a script that shows me a window that has a button that I can customize with a name like “Launch KM Engine” and when I click it, it launches the app.
Thanks again. Unfortunately, as I mentioned, I’m not familiar with AS. I got this other script from an online source and I can “kinda” understand what’s happening there when I read it, but I don’t have the knowledge to actually create something from scratch.
Would you mind sharing it? If it’s too complicated/time consuming for you, it’s ok, I understand.
Hi tiagorocha1979,
Why don’t you simply do a standard display dialog? If you hit the “OK” button, then the next step is a the launch command you need. Otherwise, you hit cancel to cancel the whole script.
Or better yet: A display dialog with 3 buttons: Cancel, Launch, and OK.
Cancel - cancels the script
Ok - does nothing and the script continues
Launch - launches the app and the script continues