Applescript,Chrome:在指定的索引处创建新标签

时间:2015-05-12 06:52:12

标签: applescript

我有这个简单的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 tabsat beginning of tabs,但如何在指定的标签索引处打开新标签页。我想在活动标签后将其作为下一个标签打开。

1 个答案:

答案 0 :(得分:2)

您可以使用术语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