1

tell application "Safari"
        set winlist to every window
        repeat with win in winlist
                set tablist to every tab in win
                repeat with t in tablist
                        name of t as string
                end repeat
        end repeat
end tell

我可以得到 safari 标签的名称

如何关闭具有特定名称的选项卡?

4

3 回答 3

3

这是另一种方法:

tell application "Safari"
    set winlist to count of every window
    repeat with i from 1 to winlist
        close (every tab of window i whose name = "Google")
    end repeat
end tell
于 2012-09-27T05:31:18.947 回答
2
tell application "Safari"
    repeat with t in tabs of windows
        tell t
            if name starts with "autom" then close
        end tell
    end repeat
end tell

tell application "Safari" to close documents where name starts with "autom"将关闭所有包含以 . 开头的选项卡的窗口autom

于 2012-09-26T13:20:34.633 回答
1

它对我不起作用 2 它们都不起作用

于 2013-06-15T03:28:04.847 回答