Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

Click here to return to the 'Open new Safari window with an AppleScript application' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Open new Safari window with an AppleScript application
Authored by: cooker47 on May 17, '10 03:37:45PM

I am using Safari Version 4.0.5 (4531.22.7) on a late 2005 Mac Mini PPC G4.

I was revisiting this 2003 topic because there are times when I just want to have a new empty Safari window with minimum clicks.

I know how to get a new empty tab using Safari Preferences and Command+T, but I try to avoid using tabs because they seem to drive a lot of overhead (Safari CPU consumption), and having Safari Preferences open new Windows with the same page is useful to keep.

I can still open a new empty tab and then "Move Tab to New Window" but that takes three clicks and I still have to copy and paste the URL I want or else do a search.

This code works great for me:

tell application "Safari"
    make new document with properties {URL:""}
end tell

I saved the script from Script Editor as an application in $HOME/Library/Scripts/Applications/Safari. Then - after using "/Applications/Applescript/AppleScript" to enable the "Show Script Menu in menu bar" - I can run the script from the menu bar when Safari is active.

Now the operation takes only two clicks, so this is quite useful.

I also created a web page to collect a few examples of launching Applescript from a link. See here.

[ Reply to This | # ]