4

I wrote this Apple Script to bless my Windows partition and boot to Windows only once:

do shell script "/usr/sbin/bless --device /dev/disk0s3 --setBoot --legacy --nextonly " with administrator privileges
tell application "System Events"
    restart
end tell
tell me to quit

However, each time I use this script to get to Windows, and then come back to OS X, it gives me the dialog that says my computer restarted because of a problem.

What is the correct "clean" or "official" way to restart with an Apple Script so that I don't get these warnings?

1 Answer 1

2

Instead of telling System Events to restart, tell Finder.

tell application "Finder"
    restart
end tell
3
  • Same result. :/
    – Karew
    Commented Aug 9, 2014 at 20:13
  • Telling Finder or System Events to restart is the canonical way to do a clean system restart via AppleScript. To convince yourself of this, try dropping your first line that's bless'ing your Windows boot partition. I suspect the unclean detection is coming from this line, not the restart.
    – Ian C.
    Commented Aug 9, 2014 at 23:25
  • Ok, it turns out this had nothing to do with the script at all. It's just happening now regardless of the way I restart.
    – Karew
    Commented Aug 10, 2014 at 18:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .