Auflisten aller Fenster aller Anwendungen

Ich versuche, ein AppleScript-Skript zu schreiben, mit dem die Größe aller geöffneten Fenster geändert wird. Um sicherzustellen, dass ich in alle Fenster komme, lasse ich mein Skript den Namen der Anwendung sowie die Anzahl der geöffneten Fenster dieser Anwendung sagen.
Interessanterweise werden in meinem Skript die Namen aller geöffneten Anwendungen mit 0 Fenstern angezeigt. Wie kann ich dieses Problem beheben?

Hier ist mein Code:

tell application "System Events"
    repeat with theProcess in (every process)
        if background only of theProcess is false then
            if name of theProcess is not "Finder" then
                if name of theProcess is "Google Chrome" then
                    say "Chrome woo hoo"
                    say (count windows as string)
                else
                    say name of theProcess as string
                    say (count windows as string)
                    tell theProcess
                        repeat with theWindow in windows
                            say "found a window of"
                            say (name of theProcess) as string
                            tell theWindow
                                click button 2
                            end tell
                        end repeat
                    end tell
                end if
            end if
        end if
    end repeat
end tell

Ich arbeite unter Mac OS X 10.7.5 und verwende Automator 2.2.4, um dieses Applescript zu schreiben / auszuführen

Antworten auf die Frage(2)

Ihre Antwort auf die Frage