Applescript,Chrome:在指定索引处创建新标签
Applescript, Chrome: Make new tab at specified index
我有这个简单的 Applescript,它会在新标签页中重新打开活动标签页
tell application "Google Chrome"
tell first window
set theUrl to URL of active tab
set myTab to make new tab at end of tabs
set URL of myTab to theUrl
end tell
end tell
所以我可以打开选项卡 at end of tabs
或 at beginning of tabs
,但是我如何在指定的选项卡索引处打开新选项卡。我想将其打开为活动选项卡后的下一个选项卡。
您可以使用术语at after tab (number)
;像这样
tell application "Google Chrome"
tell first window
set n to active tab index
set theUrl to URL of active tab
set myTab to make new tab at after tab n with properties {URL:theUrl}
end tell
end tell
我有这个简单的 Applescript,它会在新标签页中重新打开活动标签页
tell application "Google Chrome"
tell first window
set theUrl to URL of active tab
set myTab to make new tab at end of tabs
set URL of myTab to theUrl
end tell
end tell
所以我可以打开选项卡 at end of tabs
或 at beginning of tabs
,但是我如何在指定的选项卡索引处打开新选项卡。我想将其打开为活动选项卡后的下一个选项卡。
您可以使用术语at after tab (number)
;像这样
tell application "Google Chrome"
tell first window
set n to active tab index
set theUrl to URL of active tab
set myTab to make new tab at after tab n with properties {URL:theUrl}
end tell
end tell