Re: How to start/restart the Finder from an AS app?
Re: How to start/restart the Finder from an AS app?
- Subject: Re: How to start/restart the Finder from an AS app?
- From: Chris Page <email@hidden>
- Date: Mon, 21 Jan 2008 02:02:35 -0800
On Dec 21, 2007, at 00:45 AM, Philip Aker wrote: tell application "System Events" if (name of every application process does not contain "Finder") then
There's a race condition, because Finder could quit and restart before you test that it has quit, and then your script would repeat forever. Instead of testing by name, test by process id. Remember the current Finder's process id before quitting it, then check whether that specific process still exists:
tell application "System Events" set Finder_ID to id of application process "Finder" end tell
ignoring application responses tell application "Finder" to quit end ignoring
tell application "System Events" repeat while exists application process id Finder_ID delay 1 end repeat end tell
tell application "Finder" to activate
-- Chris Page - AppleScripter
The other, other AppleScript Chris
|
_______________________________________________
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