---
id: 20260630-T0-19
title: "技术教程：用一行AppleScript统计Safari标签页数量"
title_en: "How to Count Safari Tabs with a One-Line AppleScript Command"
url: https://ai.daily.yangsir.net/daily/20260630-T0-19
issue_date: 2026-06-30
publish_date: 2026-06-29T18:36:18.000Z
category: tools
source_name: "Simon Willison"
source_url: https://simonwillison.net/2026/Jun/29/safari-tab-count/#atom-everything
---

# 技术教程：用一行AppleScript统计Safari标签页数量

开发者 Simon Willison 分享了一个实用的终端技巧。通过运行 `osascript -e 'tell application "Safari" to count tabs of every window'` 命令，用户可以快速获取 Safari 浏览器当前打开的所有窗口及标签页总数。

## English Version

**How to Count Safari Tabs with a One-Line AppleScript Command**

Developer Simon Willison shared a terminal tip for counting browser tabs. By running a specific `osascript` command, users can instantly retrieve the total count of open tabs and windows in Safari.

---

**来源**：[Simon Willison](https://simonwillison.net/2026/Jun/29/safari-tab-count/#atom-everything)

**详情页**：https://ai.daily.yangsir.net/daily/20260630-T0-19

---

*智语观潮 · Daily — https://ai.daily.yangsir.net/llms.txt*