Created
February 13, 2016 21:07
-
-
Save mcbrwr/89987b4bca562d730d3d to your computer and use it in GitHub Desktop.
name all open applications and count their open windows
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
tell application "System Events" | |
repeat with theProcess in processes | |
if not background only of theProcess then | |
tell theProcess | |
set processName to name | |
set theWindows to windows | |
end tell | |
set windowsCount to count of theWindows | |
if processName is not "Finder" and processName is not "Automator" then | |
say processName | |
say windowsCount as text | |
if windowsCount is greater than 0 then | |
repeat with theWindow in theWindows | |
say "found a window of " & processName | |
tell theProcess | |
set frontmost to true | |
tell theWindow | |
click button 2 | |
end tell | |
end tell | |
end repeat | |
end if | |
end if | |
end if | |
end repeat | |
end tell |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment