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: Luther Fuller <email@hidden>
- Date: Fri, 21 Dec 2007 07:42:02 -0600
On Dec 21, 2007, at 2:45 AM, Philip Aker wrote:
On 2007-12-20, at 19:30:49, Mark J. Reed wrote:
What's the mechanism behind the "Relaunch" button in the "Force
Quit" dialog? Any way to hook into that from a script?
I don't know if there's a specific event. I've been using 'quit'
and 'activate' for years.
ignoring application responses
tell application "Finder" to quit
end ignoring
repeat
tell application "System Events"
if (name of every application process does not contain "Finder")
then
exit repeat
end if
end tell
end repeat
tell application "Finder" to activate
The repeat loop looks like a good idea. I have a utility script that
needs to quit, activate the Finder, so I tried it.
on run
local filePath
tell application "Finder"
-- do stuff here
quit
end tell
tell application "System Events"
repeat until (name of every application process does not contain
"Finder")
delay 1 -- this is necessary!
end repeat
-- do more stuff here
end tell
-- delay 1 -- this is replaced by the repeat above
tell application "Finder" to activate
end run
... and it works! If you don't put a delay within the repeat, the
repeat loop will consume 100% of your CPU for a short period of time.
Avoid this!
_______________________________________________
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