Last active
March 27, 2022 23:06
-
-
Save jjeising/a31c8ddd33479a7b6b87 to your computer and use it in GitHub Desktop.
Count the number of tabs in Safari.app
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
set n to 0 | |
set m to 0 | |
tell application "Safari" | |
repeat with w in windows | |
try | |
-- Only count windows not closed yet | |
if (visible of w) or (miniaturized of w) then | |
set n to n + (count tabs of w) | |
set m to m + 1 | |
end if | |
end try | |
end repeat | |
end tell | |
display notification (n as string) & " tabs open in " & (m as string) & " Safari windows." |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment