AppleScript:在特定标签中打开URL(Google Chrome)


1

我不再可以使用AppleScript在特定选项卡中打开URL。我尝试以下代码未成功:

set URL of tab 1 to "https://"

set myLink to "https://"
tell application "Google Chrome"
    activate
    tell front window to make new tab 1 with properties {URL:myLink}
end tell

两者均未执行所需的操作。

问题
为了完成此任务,我需要更改代码中的哪些内容?

Answers:


2

这对我适用于最新版本的macOS Sierra

set myLink to "https://google.com/"

tell application "Google Chrome"
    tell its window 1
        set theTabs to count of tabs -- how mmany open tabs
        set URL of tab 1 to myLink -- insert desired tab
        --set URL of (make new tab) to myLink
    end tell
end tell
By using our site, you acknowledge that you have read and understand our Cookie Policy and Privacy Policy.
Licensed under cc by-sa 3.0 with attribution required.