Skip to content

Instantly share code, notes, and snippets.

@steshaw
Last active August 29, 2015 14:00
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save steshaw/d979da0612a384443ee2 to your computer and use it in GitHub Desktop.
Save steshaw/d979da0612a384443ee2 to your computer and use it in GitHub Desktop.
set numTabs to 0 -- initial number of tabs
tell application "Safari"
set numWin to number of windows -- get number of Safari windows open
repeat with WinNo from 1 to numWin
tell window WinNo -- for each window, check how many tabs are open
set numTabs to numTabs + (number of tabs) -- sum those tabs up
end tell
end repeat
end tell
display dialog "Number of tabs: " & numTabs -- total number of tabs
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment