So erkennen Sie, ob iTunes im Miniplayer-Modus von Applescript ist

Gibt es eine Möglichkeit, anhand von Applescript festzustellen, ob sich iTunes im Miniplayer-Modus befindet?

Mit Mac OS X 10.8.4 Mountain Lion.

Antworten (1)

Sie können so etwas tun:

tell application "System Events"
    tell process "iTunes"
        if title of window 1 is "MiniPlayer" then
            -- If mini player
        else if title of window 1 is not "MiniPlayer" then
            -- if big player 
        end if
    end tell
end tell
Dies funktioniert wie erwartet, wenn entweder der MiniPlayer oder das Hauptfenster sichtbar sind. Das heißt, wenn das eine oder das andere, aber nicht beide sichtbar sind. Wenn jedoch beide Fenster sichtbar sind, verhält es sich immer so, als wäre MiniPlayer Fenster 1. Vielleicht ist es das, aber es wäre schön zu wissen, welches Fenster aktiv ist (den Fokus hat).