Preferences wird geöffnet, Output auf den ersten oder zweiten Eintrag umgestellt, dann iTunes geöffnet und der Output wieder auf den Ursprungswert zurück gesetzt.
Src und Programm zum Anklicken liegen als zip hier -->klick<--
Code: Alles auswählen
on ActivatePane()
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
end ActivatePane
ActivatePane()
tell application "System Events"
tell process "System Preferences"
-- get current selection
set MySelection to selected of rows of table 1 of scroll area 1 of tab group 1 of window 1
-- change selection
if item 1 of MySelection is false then
select row 1 of table 1 of scroll area 1 of tab group 1 of window 1
else
select row 2 of table 1 of scroll area 1 of tab group 1 of window 1
end if
end tell
end tell
tell application "iTunes"
activate
end tell
delay 1
ActivatePane()
tell application "System Events"
tell process "System Preferences"
-- iterate through list and restore original setting
set i to 0
repeat with MyValue in MySelection
set i to i + 1
if contents of MyValue is true then
select row i of table 1 of scroll area 1 of tab group 1 of window 1
end if
end repeat
end tell
end tell
tell application "System Preferences" to quit