--©hubionmac.com 18.12.2008
-- GUI-Skript mit dem die aktuelle Air-Tunes ausgabe verändert wird,
-- die aktuelle Airtunes-Lautsprecher-Auswahl werden quasi 
activate application "iTunes"
tell application "System Events"
    get system attribute "sysv"
    if result is greater than or equal to 4144 then -- Mac OS X 10.3.0
        if UI elements enabled then
            tell application process "iTunes"
                if (name of button 15 of window "iTunes" as text) ≠ "" then
                    set noe to false
                    click button 15 of window "iTunes" --Den ITunes Lautsprecher Button drücken
                    delay 0.25
                    -- in der Liste ganz nach unten gehene (mehrere Lautsprecher auswählen Menüpunkt 
                    repeat with i from 1 to 5
                        key code 125
                    end repeat
                    keystroke return
                    try
                        repeat with i from 1 to (count of every UI element of window 1)
                            tell UI element i of window 1
                                set rowcount to count of rows
                                if rowcount > 0 then
                                    if (value of checkbox 1 of row rowcount) as integer = 0 then
                                        --dieser part beugt einer Fehlermeldung vor… 
                                        --welcher? einfach mal diesen if-Block entfernen und Du wirst sehen =)
                                        click checkbox 1 of row rowcount
                                        set rowcount to rowcount - 1
                                    end if
                                    repeat with rownr from 1 to rowcount
                                        click checkbox 1 of row rownr
                                    end repeat
                                end if
                            end tell
                        end repeat
                    end try
                    keystroke "w" using command down
                else
                    set noe to true
                end if
            end tell
        else
            beep
            display dialog "GUI Scripting is not enabled" & return & return & "Open System Preferences and check Enable Access for Assistive Devices in the Universal Access preference pane, then run this script again." with icon stop
            if button returned of result is "OK" then
                tell application "System Preferences"
                    activate
                    set current pane to pane "com.apple.preference.universalaccess"
                end tell
            end if
        end if
    else
        beep
        display dialog "This computer cannot run this script" & return & return & "The script uses GUI Scripting technology, which requires an upgrade to Mac OS X 10.3 Panther or newer." with icon caution buttons {"Quit"} default button "Quit"
    end if
end tell
if noe = true then
    tell application "iTunes" to display dialog "nö, keine Airtunes Lautsprecher angeschlossen bzw. kein Button da, wo man so etwas auswählen könnt :-/"
end if

Add a comment

Next Post Previous Post