• 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
Re: unresponsive apps and applescript
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: unresponsive apps and applescript


  • Subject: Re: unresponsive apps and applescript
  • From: Ron Hunsinger <email@hidden>
  • Date: Wed, 26 Jun 2013 19:29:44 -0700

On Jun 26, 2013, at 2:24 PM, Dee Dee Sommers <email@hidden> wrote:
> Is there any way I can set a flag someplace so I know to restart the Applescript?

You're probably going to invoke a shell script to kill the app. That same shell script can pause a couple of seconds (using /bin/sleep) and then re-launch the the AppleScript (using /usr/bin/osascript). The AppleScript can relaunch the app if it's not already running.

Be sure that the command line you pass to "do shell script" ends with an ampersand, signaling the shell that you don't want to wait for it to complete. Otherwise, your current invocation of the AppleScript will hang around waiting for /bin/sleep and /usr/bin/osascript (and therefore also the second invocation of the AppleScript) to finish. Fire off the shell script and then immediately quit.

I should stress that quitting and restarting the AppleScript is a kludge, something that will (sort of) do the right thing with minimal effort on your part. The right thing (and what will probably wind up giving you the least trouble, although it may seem otherwise in the short run) is to implement proper error handling. Reorganizing your work flow around transactions sounds like an excellent idea.

-Ron Hunsinger
 _______________________________________________
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: unresponsive apps and applescript
      • From: Dee Dee Sommers <email@hidden>
References: 
 >unresponsive apps and applescript (From: Dee Dee Sommers <email@hidden>)
 >Re: unresponsive apps and applescript (From: 2551 <email@hidden>)
 >Re: unresponsive apps and applescript (From: Dee Dee Sommers <email@hidden>)
 >Re: unresponsive apps and applescript (From: Ron Hunsinger <email@hidden>)
 >Re: unresponsive apps and applescript (From: Dee Dee Sommers <email@hidden>)

  • Prev by Date: Mail Scripting - Copy Messages to Finder Folder
  • Next by Date: menu bar 1 in 10.8?
  • Previous by thread: Re: unresponsive apps and applescript
  • Next by thread: Re: unresponsive apps and applescript
  • Index(es):
    • Date
    • Thread