我正在尝试编写一个调整所有打开窗口大小的applescript 脚本。为了确保我可以访问所有窗口,我让我的脚本说出应用程序的名称以及该应用程序的打开窗口数。
有趣的是,当我听到所有打开的应用程序的名称时,我的脚本说它们都打开了 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 编写/运行这个 applescript