【问题标题】:Count windows that contain a determined word计算包含确定单词的窗口
【发布时间】:2026-01-20 17:20:03
【问题描述】:

我一直使用这个命令来计算窗口数:

set windowsnumber to count windows

现在我需要计算包含特定字符串的窗口。

例如如果一个进程打开了 5 个窗口(窗口“A”、“B”、“A”、“C”、“D”),我需要类似“计算标题中包含“A”的窗口”之类的东西,应该返回 2在这个例子中。

这对applescript可行吗?

【问题讨论】:

    标签: macos window applescript counting contain


    【解决方案1】:

    使用whose 过滤器:

    set windowsnumber to count (windows whose title contains "A")
    

    【讨论】:

      最近更新 更多