Guarda un script como este ~/Library/Scripts/test.scpt
en el Editor de AppleScript:
tell application "Grapher"
activate
reopen
end tell
tell application "System Events" to tell process "Grapher"
click radio button 2 of tab group 1 of window 1
-- UI elements of window 1
end tell
Guárdelo como ~/Library/LaunchAgents/test.plist:
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC -//Apple Computer//DTD PLIST 1.0//EN
http://www.apple.com/DTDs/PropertyList-1.0.dtd>
<plist version="1.0">
<dict>
<key>Label</key>
<string>test</string>
<key>ProgramArguments</key>
<array>
<string>osascript</string>
<string>/Users/username/Library/Scripts/test.scpt</string>
</array>
<key>RunAtLoad</key>
<true/>
</dict>
</plist>
Más información sobre las secuencias de comandos de la interfaz de usuario y launchd: