Re: Relaunch Finder (without AppleScript)
Re: Relaunch Finder (without AppleScript)
- Subject: Re: Relaunch Finder (without AppleScript)
- From: Uli Kusterer <email@hidden>
- Date: Wed, 16 Jul 2008 16:35:08 +0200
On 16.07.2008, at 16:01, Dave DeLong wrote:
You could use an NSTask to run "killall Finder"
Yeah, and in the process you'll unceremoniously abort that 4GB copy
process the user had going that was this close to finishing, and
corrupt Finder's preferences...
If you're on 10.5, use the scripting bridge. If you're on 10.4.x or
earlier, you can drop down to CoreServices and manually send the Apple
Event. Create the event using NSAppleEventDescriptor, and then call -
aeDesc to get an AEDesc to pass to AESend(). The quit Apple event is
very simple, as it takes no parameters, and is of class/type
kCoreEventClass/kAEQuitApplication.
Check the result, though, Finder may refuse to quit if it's busy,
like aforementioned copy process.
To launch Finder again after that, use NSWorkspace.
Cheers,
-- Uli Kusterer
"The Witnesses of TeachText are everywhere..."
http://www.zathras.de
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden