Re: Shutdown/Restart computer
Re: Shutdown/Restart computer
- Subject: Re: Shutdown/Restart computer
- From: Nick Zitzmann <email@hidden>
- Date: Mon, 14 Sep 2009 19:29:55 -0600
On Sep 14, 2009, at 6:59 PM, PCWiz wrote:
How would I shut down and restart the computer using Objective-C code?
Don't use the /sbin/shutdown command as previously recommended. That
command will not give users the chance to save their work before the
reboot/shutdown. Instead, send events to the "System Events"
application. You can do this easily using NSAppleScript, by running a
script like "tell application \"System Events\" to restart". If you
know what you're doing, you could probably make that even faster by
using AESend() directly...
Nick Zitzmann
<http://www.chronosnet.com/>
_______________________________________________
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