Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

My code looks like this

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

But if I have Firefox open, the link will open in a new tab. But I want the link to open in a new Firefox window. How can I accomplish that?

like image 479
tabaluga Avatar asked Sep 05 '10 10:09

tabaluga


2 Answers

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.

like image 58
Dan Avatar answered Sep 27 '22 19:09

Dan


this works, but opens your welcome site in first tab...

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
like image 21
blubb Avatar answered Sep 27 '22 19:09

blubb