Skip to content

Instantly share code, notes, and snippets.

@jjeising
Last active March 27, 2022 23:06
Show Gist options
  • Save jjeising/a31c8ddd33479a7b6b87 to your computer and use it in GitHub Desktop.
Save jjeising/a31c8ddd33479a7b6b87 to your computer and use it in GitHub Desktop.
Count the number of tabs in Safari.app
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