Count the number of Safari tabs
A quick tip shows how to count open Safari tabs using an AppleScript command: "osascript -e 'tell application "Safari" to count tabs of every window'". The author ran it and discovered they had 370 tabs open.
Background
- **Simon Willison** is a well-known web developer, open-source advocate, and author of the Django web framework. His blog often shares small technical tips ("TILs" or "Today I Learned").
- **AppleScript** is Apple's built-in scripting language for macOS. It lets users automate tasks across applications — like querying how many tabs are open in Safari — but its syntax is rarely used by modern developers, so tricks like this feel obscure.
- **`osascript`** is a command-line tool on macOS that runs AppleScript directly from the terminal, enabling quick automation without opening the Script Editor.
- The image shows the result: 370 open tabs. Willison is gently poking fun at himself for having an excessive number of open tabs, a common mix of guilt and amusement among heavy browser users.