DEV Community

Magne
Magne

Posted on

Count number of tabs in Safari

Finder → Go → Utilities → Script Editor:

tell application "Safari"
    count of tabs of front window
end tell
Enter fullscreen mode Exit fullscreen mode

Or:

tell application "Safari"
    count every tab of every window
end tell
Enter fullscreen mode Exit fullscreen mode

Don't worry, if any AppleScript has a bug and doesn't run, then it won't affect Safari. It simply gives an error in the Script Editor.

Discussion (0)