1

I'm trying to use Automator to create a system-wide shortcut to open a new Safari window. I'm using the method described in this answer.

I can get Safari to open a specific url, for example by running

$ open -a Safari "https://apple.stackexchange.com"

From the command line. But this opens a new tab (not a new window) and requires specifying a URL.

Automator also has an "Internet > Display Webpages" action that has the same problems.

enter image description here

Is there a way to get Safari to open a new, blank window?

  • 2
    Try using a Run AppleScript action, replacing the default code, with: tell application "Safari" to make new document – user3439894 Nov 11 '18 at 21:54
  • 1
    Does it have to be in Automator? If not, this is easily accomplished in Keyboard Maestro where you could make a macro to activate Safari and then do ⌘N (or select the File » New Window menu), and then assign a keyboard shortcut for that. – TJ Luoma Nov 12 '18 at 0:12
  • Thanks, the AppleScript action worked brilliantly. I didn't try Keyboard Masetro but that product also looks impressive. Thank you both! – bcattle Nov 12 '18 at 4:51
1

In Automator, create a Service workflow (pre macOS Mojave), or a Quick Action workflow in macOS Mojave.

Add a Run AppleScript action, replacing the default code, with:

tell application "Safari" to make new document

The above piece of AppleScript code by itself will open a new window in Safari however, it will not have focus. If you want the new window to have focus then use a tell block, e.g.:

tell application "Safari"
    make new document
    activate
end tell

You can then assign a keyboard shortcut in the usual manner per information in the link within your question.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .