0

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?

Patrick Cook
  • 458
  • 12
  • 27
  • Could you be more specific about what you're doing, and which kind of app you saved this as, normal app or stay-open app? I suspect you're thinking the user can quit in the middle of the delay? Also, there are other things weird or wrong with the script as you've written it (like, why is this in a System Events tell block?). As it is, though, the try is not catching the quit. – CRGreen Feb 28 '15 at 18:17
  • Whats the different between a stay-open app and a normal app? Also, there is a `tell application "System Events"` so that the `display dialog` is moved to the front automatically so that you do not have to click the app to see the dialog. – Patrick Cook Feb 28 '15 at 19:49

1 Answers1

0

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"
regulus6633
  • 18,848
  • 5
  • 41
  • 49