Вывод списка всех окон всех приложений
Я пытаюсь написать сценарий яблочного сценария, который изменяет размеры всех открытых окон. Чтобы убедиться, что я попадаю во все окна, я заставляю свой скрипт произносить имя приложения, а также количество открытых окон этого приложения.
Интересно, что хотя я слышу имена всех моих открытых приложений, мой сценарий говорит, что у них всех открыто 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
Я на Mac OS X 10.7.5, использую Automator 2.2.4, чтобы написать / запустить этот яблочный скрипт