Re: best approach?
Re: best approach?
- Subject: Re: best approach?
- From: Shane Stanley <email@hidden>
- Date: Tue, 08 Dec 2015 14:55:26 +1100
On 8 Dec 2015, at 2:42 PM, 2551 <email@hidden> wrote:
Won’t that fail rather ungracefully if the app isn’t running when the script is executed (e.g. what if the app crashed and terminated just as the user executed the script)?
Yes, it would be better like this perhaps:
on forceQuitAppID:theID set theApp to (current application's NSRunningApplication's runningApplicationsWithBundleIdentifier:theID)'s firstObject() if theApp is not missing value then -- still running set theURL to theApp's bundleURL() theApp's forceTerminate() delay 0.5 current application's NSWorkspace's sharedWorkspace()'s openURL:theURL else -- it's already quit delay 0.5 tell current application's NSWorkspace's sharedWorkspace() set theURL to its URLForApplicationWithBundleIdentifier:theID its openURL:theURL end tell end if end forceQuitAppID:
|
_______________________________________________
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