Tabs 关闭Safari选项卡
我到处搜索,包括这里,想找到一个关闭标签的方法。 我有这样的代码可以工作:Tabs 关闭Safari选项卡,tabs,safari,applescript,Tabs,Safari,Applescript,我到处搜索,包括这里,想找到一个关闭标签的方法。 我有这样的代码可以工作: tell application "Safari" repeat with aWindow in windows repeat with aTab in tabs of aWindow if name of aTab is "Facebook" then tell aTab to close end if
tell application "Safari"
repeat with aWindow in windows
repeat with aTab in tabs of aWindow
if name of aTab is "Facebook" then
tell aTab to close
end if
end repeat
end repeat
end tell
我打开了一个Facebook标签,但它不起作用,当关闭整个窗口时,代码似乎起作用
谢谢 试试看:
tell application "Safari" to close (every tab of every window whose name = "Facebook")
您需要在代码的重复循环中包含内容
tell application "Safari"
repeat with aWindow in windows
repeat with aTab in tabs of (contents of aWindow)
set aTab to contents of aTab
if name of aTab is "Facebook" then
tell aTab to close
end if
end repeat
end repeat
end tell
是你的。我的一个生成的日志似乎一切正常,但选项卡仍然打开。试着运行它。