如何指示Applescript打开带有链接的新Firefox窗口?

tab*_*uga 9 firefox applescript

我的代码看起来像这样

tell application "Firefox"
 open location "http://rubyquicktips.tumblr.com/"
end tell
Run Code Online (Sandbox Code Playgroud)

但如果我打开Firefox,链接将在新标签中打开.但我希望链接在新的Firefox窗口中打开.我怎么能做到这一点?

小智 8

这有效,但在第一个标签中打开您的欢迎网站...

tell application "Firefox" to activate
tell application "System Events" to keystroke "n" using command down
delay 3
tell application "Firefox"
    open location "http://rubyquicktips.tumblr.com/"
end tell
Run Code Online (Sandbox Code Playgroud)


reg*_*633 5

尝试这个...

tell application "Firefox"
    OpenURL "http://rubyquicktips.tumblr.com/"
end tell
Run Code Online (Sandbox Code Playgroud)

或者试试这个...

tell application "Firefox" to activate
tell application "System Events" to keystroke "n" using command down
tell application "Firefox"
    OpenURL "http://rubyquicktips.tumblr.com/"
end tell
Run Code Online (Sandbox Code Playgroud)


Dan*_*Dan 5

我并不完全熟悉 AppleScript,但我希望打开一个全新的默认窗口。这是一个有效的方法:

tell application "System Events"
    tell process "Firefox"
        click menu item "New Window" of menu "File" of menu bar 1
    end tell
end tell
Run Code Online (Sandbox Code Playgroud)

(可选)要关注新窗口,请在后面添加以下行:

tell application "Firefox"
    activate
end tell
Run Code Online (Sandbox Code Playgroud)

这将打开一个默认的新窗口。可能有更好的方法。