Skip to content

Instantly share code, notes, and snippets.

@stevoyoung
Created July 31, 2012 07:45
Show Gist options
  • Save stevoyoung/3214626 to your computer and use it in GitHub Desktop.
Save stevoyoung/3214626 to your computer and use it in GitHub Desktop.
Open New Safari Window and make it active
-- This AppleScript is used to create a new safari window then it brings Safari to the front.
-- I'm using this as a script I can trigger via Alfred. It's particularly nice when you work
-- in many spaces on your Mac. If you are in a space that doesn't have a Safari window open
-- it will simply open a new window in that space without switch spaces on you.
-- Feel free to copy and use however you would like.
-- Created by Stephen Young, @stevoyoung
-- Hey, Safari, I'm talking to you ...
tell application "Safari"
-- open new safari window and go to specific url. If you want a blank window, simple use "make new document" instead.
make new document with properties {URL:"http://www.google.com"}
-- bring Safari to the front
activate
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment