Reputation: 24834
with
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
I can get the name of safari tab
how I can close a tab with a specific name ?
Upvotes: 1
Views: 4509
Reputation: 29
It doesn't work for me 2 Neither of them work The strange thing is, it does work when the safari is not in fullscreen I guess it is a bug in safari
Upvotes: 1
Reputation: 11238
Here is another approach:
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
Upvotes: 3
Reputation: 27633
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"
would close all windows that contain tabs that start with autom
.
Upvotes: 2