Hi all
Can anyone tell me why this script isn’t working?
I have a window with one slider called “slider1”:
on action slider1
set _value to the value of slider1
display dialog _value
end action
(I get NSCannotCreatScriptCommandError (10))
Why I need want/need this to work is outlined below (if you want to read on…)
Many thanks - in advance for any help. It is greatly appreciated
Ron
I’m trying to create a slider that can control the balance of the sound output system preference.
I’ve been able to make this work using two buttons (named “increment” and “decrement”):
on clicked theObject
if the name of theObject is equal to “increment” then
activate application “System Preferences”
tell application “System Events”
tell process “System Preferences”
perform action “AXIncrement” of slider 1 of group 1 of window “Sound”
end tell
end tell
end if
if the name of theObject is equal to “decrement” then
activate application “System Preferences”
tell application “System Events”
tell process “System Preferences”
perform action “AXdecrement” of slider 1 of group 1 of window “Sound”
end tell
end tell
end if
But can anyone tell me how I would do this with a slider?
I have tried various variations on this:
on action slider1
set _firstValue to 50
–50 is the start off value of the slider–
set _currentValue to the value of slider1
if _currentValue > firstValue then
activate applicatioin “System Preferences”
tell application “System Events”
tell process “System Preferences”
perform action “AXIncrement” of slider 1 of group 1 of window “Sound”
end tell
end tell
end if
if _currentValue < firstValue then
activate application “System Preferences”
tell application “System Events”
tell process “System Preferences”
perform action “AXdecrement” of slider 1 of group 1 of window “Sound”
end tell
end tell
end if
set _firstValue to _currentValue
end action
???
Cheers