• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Shutdown/Restart computer
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


References: 
 >Shutdown/Restart computer (From: PCWiz <email@hidden>)

  • Prev by Date: Need -[NSTask waitUntilExitOrTimeout:] (was NSTask "Thread Unsafe"...)
  • Next by Date: Re: adding a page curl transition
  • Previous by thread: Re: Shutdown/Restart computer
  • Next by thread: Re: Shutdown/Restart computer
  • Index(es):
    • Date
    • Thread