rei*_*ein 2 macos firefox applescript
我需要在FireFox中编写具有特定标题的选项卡的关闭脚本.FireFox是否与下面的AppleScript示例等效?
关闭Safari中的标签:
tell application "Safari"
delete (every tab of every window where its name contains "[done]")
end tell
Run Code Online (Sandbox Code Playgroud)
关闭Chrome中的标签:
tell application "Google Chrome"
delete (every tab of every window where its title contains "[done]")
end tell
Run Code Online (Sandbox Code Playgroud)
由于Firefox没有任何AppleScript支持,因此您需要依赖UI脚本.当然,Firefox的非标准用户界面也无济于事,但仍有可能.试试这个:
tell application "System Events" to tell process "firefox"
set frontmost to true
repeat with w from 1 to count of windows
perform action "AXRaise" of window w
set startTab to name of window 1
repeat
if name of window 1 contains "[done]" then
keystroke "w" using command down
else
keystroke "}" using command down
end if
delay 0.2
if name of window 1 is startTab then exit repeat
end repeat
end repeat
end tell
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2958 次 |
| 最近记录: |