How do I instruct Applescript to open a new Firefox window with a link?

后端 未结 4 2135
慢半拍i
慢半拍i 2021-02-20 02:46

my code looks like this

tell application \"Firefox\"
 open location \"http://rubyquicktips.tumblr.com/\"
end tell

but if I have Firefox open, t

4条回答
  •  暖寄归人
    2021-02-20 03:48

    I'm not entirely familiar with AppleScript, but I was looking to open a brand new default window. Here's a method that works:

    tell application "System Events"
        tell process "Firefox"
            click menu item "New Window" of menu "File" of menu bar 1
        end tell
    end tell
    

    Optionally, to focus on the new window, add these lines afterward:

    tell application "Firefox"
        activate
    end tell
    

    This will open a default new window. There may be a better way.

提交回复
热议问题