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 に答える