Re: unresponsive apps and applescript
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