Quitting a script


I have quite a long script that loops indefinitely until the user quits the script. Currently this is done by pressing a quit button.
It would make everything a lot easier if the user could quit using right click - quit, and I would also like the app to quit when the machine is shut down, currently the app prevents the machine from shutting down.

I can’t figure out how to handle either events. Help would be appreciated.



you can’t create contextual menu items in AppleScript, not even in AppleScript Studio.
Alternatively save your script as application, then the shut down process will quit it
and the user can quit the app from the dock or with its regular quit menu item

Thats exactly the problem I’m having. The script is an application, but will not quit on shutdown or from the dock. I do not have keep open selected.

Then maybe the code should or could be improved :wink:

Do you have an “on quit” handler containing the line (as a minimum) “continue quit”? I know that’s an absolute requirement for a stay open script with a quit call, but don’t know the structure of yours.