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 protected]) 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: http://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to [email protected]
