Вывод списка всех окон всех приложений

Я пытаюсь написать сценарий яблочного сценария, который изменяет размеры всех открытых окон. Чтобы убедиться, что яЯ добираюсь до всех окон, яЯ делаю так, чтобы мой скрипт произносил имя приложения, а также количество открытых окон этого приложения.

Интересно, что хотя я слышу имена всех моих открытых приложений, мой сценарий говорит, что у них всех открыто 0 окон. Как я могу исправить эту проблему?

Вот'мой код: я

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

m в Mac OS X 10.7.5, используя автомат 2.2.4 для записи / запуска этого кода

Ответы на вопрос(2)

Ваш ответ на вопрос