Scripting Startup Disk Changes

I wanted to build an Applescript to change the startup disk of my Intel iMac to the Windows partition. I've tried 2 methods, and since this is really my first stab at AppleScript, neither has worked. Any ideas?

Here were my two plans. I think both are terribly wrong. Please help!

tell application "System Preferences"
activate
set current pane to pane "Startup Disk"
tell application "System Events"
tell application process "System Preferences"
tell window "System Preferences"
tell "Startup Disk"
tell "split group"
tell "group"
tell "scroll area"
tell "radio group"
perform action "AXPress" of "Windows on Untitled"
end tell
end tell
end tell
end tell
end tell
end tell
end tell
end tell



and also this


tell application "System Preferences"
activate
set current pane to pane "Startup Disk"
tell application "System Events"
perform action "AXPress" of "Windows on Untitled" of "radio group" of "scroll area" of "group" of "split group" of "Startup Disk" of "System Preferences"
end tell
end tell


iMac core duo Mac OS X (10.4.6)

Posted on Jun 15, 2006 10:18 AM

Reply
3 replies

Jun 18, 2006 9:05 AM in response to Eric Broockman

tell application "System Preferences" -- Launch 'System Preferences'.
activate -- Set as front most process.
set current pane to pane "com.apple.preference.startupdisk" --"com.apple.preference.network" -- Select 'StartUp Disk' utility.
delay 8 -- Provide a pause (the value is in seconds), long enough for the 'bootable volumes' list to be dynamically created.
end tell

try -- Capture any unwanted error message.
-- Emulate locating and and clicking on 'Windows on Untitled' volume.
tell application "System Events" to tell process "System Preferences" to click button "Windows on Untitled" of radio group 1 of scroll area 1 of group 1 of splitter group 1 of window 1
end try

Mac OS X (10.4.4)

This thread has been closed by the system or the community team. You may vote for any posts you find helpful, or search the Community for additional answers.

Scripting Startup Disk Changes

Welcome to Apple Support Community
A forum where Apple customers help each other with their products. Get started with your Apple Account.