Salva uno script come ~/Library/Scripts/test.scpt
in AppleScript Editor:
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
Salva come ~ / Libreria / 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>
Ulteriori informazioni su scripting dell'interfaccia utente e launchd: