Add Operation to File Menu in an Applescript Application

73 views Asked by At

I have an application that was made with applescript for now I can substitute this for the code:

try
    tell application "System Events"
        delay 10
        display dialog "blah blah"
    end tell
end try

and I would like the user to be able to quit this application by either rick clicking on it and selecting "Quit" or by going to File>Quit. But I believe the try is catching the quit. Is there any way to do this?

1

There are 1 answers

0
regulus6633 On

You can't do what you ask. Even if possible, the delay statement stops everything for 10 seconds so it can't catch any "quit" actions. If you explain a little more about what you're trying to do then there may be another way to accomplish your goal.

Note also that in Yosemite the delay command isn't working properly. It's a bug. You can use this instead until the bug is fixed.

do shell script "sleep 10"