I’m trying to write a script which will access system preferences and change to OS 9.2.
tell application “System Preferences”
set startup disk of alias “Macintosh HD:” to “Mac OS 9.2.2”
end tell
But this does not work. I get an “access denied” error. I am very frustrated with the verbage in Applescript. there does not seem to be documentation on this and the application’s dictionary does not help either. does anybody have any suggestions. I have 2 books on applescript and they both suck.
I don’t see anything in the AppleScript dictionary of System Preferences that indicates that your script would work. As far as I know, the only way to do this in OS X is by using GUI Scripting. If this is the way you decide to go, I have a script that you might be interested in. It isn’t complete (it needs error checking and final tweaking) but it might serve as a starting point for you. FYI, it also requires Extra Suites.
Okey dokey. On my machine, this script will select the second disk from the left in the Startup Disk pane. It may need to be localized for non-English systems.
-- Open startup disk pane
tell application "System Preferences"
activate
set bounds of window 1 to {278, 32, 873, 600} -- for consistent location
repeat with thisPane in panes
if localized name of thisPane is "Startup Disk" then
set current pane to thisPane
exit repeat
end if
end repeat
end tell
delay 2 -- might not be needed
-- Select new disk as startup disk
tell application "Extra Suites"
move mouse {500, 190}
click mouse
end tell
-- Restart computer
tell application "System Events" to tell application process "System Preferences"
tell button "Restart?" of window "Startup Disk" to click
tell button "Save and Restart" of sheet 1 of window "Startup Disk" to click
end tell -->
The coordinates will likely need to be modified to reflect your setup. I wrote this for myself and it isn’t complete so there is no error checking or optimization. It is offered only as a crude working example.
[Tested successfully on a OS X 10.2.5 US English setup.]