Ori*_*751 7 google-chrome applescript macos
我希望以下代码可以完成这项工作,但没有雪茄:
--Only the window is brought into focus
tell application "Google Chrome"
activate tab 1 of window 1
end tell
Run Code Online (Sandbox Code Playgroud)
Dan*_*eck 11
事实上,谷歌浏览器是可编写脚本的。
tell application "Google Chrome" to set active tab index of first window to 3
Run Code Online (Sandbox Code Playgroud)
对于版本 10.0.648.204 来说就像一个魅力。
虽然执行以下操作会很好:
tell application "Google Chrome" to set active tab of first window
to first tab of the first window whose title is "Super User"
Run Code Online (Sandbox Code Playgroud)
这是不可能的,因为active tab
它是只读属性。您需要遍历所有窗口的选项卡以通过查询每个选项卡的标题找到所需的索引,然后设置active tab index
:
tell application "Google Chrome"
set i to 0
repeat with t in (tabs of (first window whose index is 1))
set i to i + 1
if title of t is "Super User" then
set (active tab index of (first window whose index is 1)) to i
end if
end repeat
end tell
Run Code Online (Sandbox Code Playgroud)
归档时间: |
|
查看次数: |
12126 次 |
最近记录: |