Last active
October 26, 2015 20:55
-
-
Save pwc3/9754912 to your computer and use it in GitHub Desktop.
This file contains 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" | |
tell process "Tweetbot" | |
repeat | |
-- need to put this in a try block as it sometimes fails | |
try | |
-- loop over all of the windows | |
repeat with _window in windows | |
-- if the title isn't "Main Window"... | |
if title of _window is not "Main Window" then | |
-- ... close it by performing AXPress on button 1 (which corresponds to the red stoplight button) | |
tell _window | |
tell button 1 to perform action "AXPress" | |
end tell | |
end if | |
end repeat | |
end try | |
if (count of windows) is 1 then exit repeat | |
end repeat | |
end tell | |
end tell | |
beep |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment