Q: AppleScript Error 10810
How do I fix the following?
root# /usr/bin/osascript /Users/me/Documents/balance_volume.scpt
/Users/josh/Documents/balance_volume2.scpt: execution error: An error of type -10810 has occurred. (-10810)
My iMac volume balance constantly sets itself to a new random position so I created the following AppleScript:
tell application "System Preferences"
activate
set current pane to pane "com.apple.preference.sound"
reveal (first anchor of current pane whose name is "output")
end tell
tell application "System Events"
launch
tell process "System Preferences" to tell slider 1 of group 1 of tab group 1 of window 1 to set value to 0.5 --center balance
-- tell process "System Preferences" to set value of slider 1 of group 1 of window "Sound" to 0 --maximize volume
quit application "System Preferences"
end tell
The script works everytime when run from AppleScript Editor. But if I save and try to run from the command line, it runs sometimes, but not others. Eventually I want to put in crontab:
* 20 * * * /usr/bin/osascript /Users/me/Documents/balance_volume.scpt
I've read about "compiling" or saving as an application the scpt file but not sure how to do this.
Thank you.
Posted on Feb 21, 2013 5:21 PM
