hi
i’m starting a script which accesses the system prefs pane but can’t get it to activate and go into the sharing section
it just errors,
But if i have system prefs open already it works ok
activate application "System Preferences"
tell application "System Events"
tell process "System Preferences"
application "System Preferences"
tell menu bar 1
tell menu bar item "View"
tell menu 1
click menu item "Sharing"
end tell
end tell
end tell
end tell
end tell
There may be a better way but you can add the following before what you have now. This opens System Preferences and adds a delay for it to show up:
tell application "System Preferences"
activate
repeat until name of preferences window is "System Preferences"
tell application "System Events"
tell process "System Preferences"
application "System Preferences"
end tell
end tell
end repeat
delay 2
end tell
I was trying to find a way to test for the menu item name. I tried to get it to wait for the View menu bar item to appear but I couldn’t get that working.
All of the properties are listed in System Preferences’ dictionary. Note, however, that ˜name’ may vary depending on the current language. The ˜id’ property is the locale indepentant name.