• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Exiting an app with an infinite loop?
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Exiting an app with an infinite loop?


  • Subject: Exiting an app with an infinite loop?
  • From: "@lbutlr" <email@hidden>
  • Date: Sun, 28 Aug 2016 15:58:18 -0600

I have a script that (barebones) does the following:

repeat
tell application "System Events" to set myApp to first process where it is frontmost
tell application “MyAppGoesHere”
activate
-- Magic Happens Here
end tell
tell application "System Events" to set frontmost of myApp to true
delay 600
end repeat

Which works fine. The only issue is that I cannot quit the app when I no longer need it to run. It is saved as an Application and I can bring the app to the foreground and I get the menu bar and I select quit and… nothing.

I have to force quit the applescript app.

Now, sometimes I have this app running for a couple of hours, and sometimes I have it running for a couple of days, so setting the repeat to a specific number or times is not workable. I tried using a display dialog with a short time out so I could press cancel, those this meant I may have to wait 10 minutes for the dialog to reappear.

display dialog “Continue?” giving up after 2

But that would often cause the script to time out with the dialog open.

(I am running on 10.12 developer beta currently, but I am pretty sure this is the same behavior I had in 10.11.3)

Ideas?


 _______________________________________________
Do not post admin requests to the list. They will be ignored.
AppleScript-Users mailing list      (email@hidden)
Help/Unsubscribe/Update your Subscription:
Archives: http://lists.apple.com/archives/applescript-users

This email sent to email@hidden

  • Follow-Ups:
    • Re: Exiting an app with an infinite loop?
      • From: "Stockly, Ed" <email@hidden>
    • Re: Exiting an app with an infinite loop?
      • From: Barry Wainwright <email@hidden>
  • Prev by Date: Re: "where its" vs "whose"
  • Next by Date: Re: Exiting an app with an infinite loop?
  • Previous by thread: Re: "where its" vs "whose"
  • Next by thread: Re: Exiting an app with an infinite loop?
  • Index(es):
    • Date
    • Thread