Re: Programmatically restarting Mac OS X
Re: Programmatically restarting Mac OS X
- Subject: Re: Programmatically restarting Mac OS X
- From: Greg Herlihy <email@hidden>
- Date: Tue, 13 Jun 2006 17:26:45 -0700
- Thread-topic: Programmatically restarting Mac OS X
The Finder "restart" Applescript command (even though it works) is outdated
- the modern way to restart the system using Applescript is to send a
"restart" command to System Events.
Greg
On 6/13/06 5:13 PM, "Damien Sorresso" <email@hidden> wrote:
> On 13 Jun, 2006, at 5:03 PM, Gregory Weston wrote:
>> matt jaffa wrote:
>>
>>> Is there a nice way of programmatically restarting Mac OS X that
>>> works on
>>> 10.2 and above?. I was using the Apple events from a technical
>>> note but when
>>> certain system updates or security updates are installed on Jaguar
>>> these
>>> methods don't work till the system reboots. "reboot" or "shutdown"
>>> commands
>>> are nice about a restart, not allowing users to save unsaveds
>>> documents
>>> first.
>>>
>>
>> Not sure which technical note you're referencing or (as a result)
>> what methods aren't working, but not more than a minute ago I had
>> smashing success with this AppleScript:
>>
>> tell application "Finder" to restart
>>
>> Should still work wrapped up in an NSAppleScript object, I would
>> think.
>
> I have no way of knowing, but I'd venture a guess that the `restart'
> command in the Finder's dictionary sends the restart Apple event to
> the login window. The tech note he's referring to describes how to do
> this programmatically. If it's not working through the C API, it
> might not work through AppleScript either.
>
> I'd suggest executing the command line `reboot', but that requires
> root privileges. Though I *think* it'll execute a logout before
> rebooting, which will prompt the user for saving changed documents.
> If you don't mind prompting your user for authorization, that might
> be one solution.
>
> Matt, have you tried any of the other login window Apple events on
> Jaguar?
_______________________________________________
Do not post admin requests to the list. They will be ignored.
Cocoa-dev mailing list (email@hidden)
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden