
motion detector and itunes script
Hi i need some help with my script.
My motion detector is coming from Norm on Wednesday. I would like to embed this script when it detects motion. the problem i am having is to tell the system volume to decrease
after the song has played. i realise my code is a bit messy help appreciated.
RT
- Code: Select all
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 --center balance
tell process "System Preferences" to set value of slider 1 of group 1 of window "Sound" to 7 --maximize volume
end tell
tell application "System Preferences"
quit
end tell
tell application "iTunes"
activate
end tell
tell application "iTunes"
set the current EQ preset to EQ preset "Flat"
end tell
tell application "iTunes"
set the sound volume to 90
end tell
tell application "iTunes"
play track named "Just Dance" of playlist "doorbell" with once
end tell
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 --center balance
tell process "System Preferences" to set value of slider 1 of group 1 of window "Sound" to 0 --maximize volume
end tell
tell application "System Preferences"
quit
end tell