iTBotB

Q: Applescript application won't quit while in delay

Here's my simple Applescript application:

     delay 60

     beep 2

 

I run it. It has an icon in the Dock. I right-click icon and choose option Quit. It doesn't quit until the 60 second delay is over. Then, it quits before beeping. I tried putting a 6-second delay in a repeat 10 loop, but the app wouldn't quit while in the loop. I put 10 6-second delays in a row, but that didn’t work. I put nonsense commands (set yum to 1) after each delay. That didn't work. It appears that any upcoming delay prevents Quit from working.

 

It's ridiculous to need Force Quit to quit a simple AppleScript app. Any suggestions?

Mac Pro (Early 2009), Mac OS X (10.6.8)

Posted on Sep 13, 2016 10:30 PM

Close

Q: Applescript application won't quit while in delay

  • All replies
  • Helpful answers

  • by Hiroto,

    Hiroto Hiroto Sep 14, 2016 3:23 AM in response to iTBotB
    Level 5 (7,286 points)
    Sep 14, 2016 3:23 AM in response to iTBotB

    Hello

     

    You may use command + . (period) to cancel script execution.

     

    See what you get by pressing command + . when the following script is running:

     

    try
        delay 10
        display dialog "Done"
    on error errs number errn
        display dialog errs & " " & errn
    end try
    

     

     

    Tested under OS X 10.6.8.

     

    H