Skip to content

Instantly share code, notes, and snippets.

@elasticthreads
Created March 23, 2011 14:34
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save elasticthreads/883187 to your computer and use it in GitHub Desktop.
Save elasticthreads/883187 to your computer and use it in GitHub Desktop.
some AppleScript gists to open a new tab for web search
BEST (pops up a dialog to enter a search term and then opens that google search in a new tab in whatever browser is default):
set gSearch to the text returned of (display dialog "Google:" default answer "")
set gSearch to "http://www.google.com/search?q=" & gSearch
tell application "System Events" to open location gSearch
Safari:
tell application "Safari"
tell front window to set current tab to make new tab
activate
end tell
tell application "System Events" to key code 3 using {command down, option down}
Chrome:
tell application "Google Chrome"
tell front window to make new tab
activate
end tell
Firefox:
tell application "System Events"
tell application "Firefox" to activate
keystroke "t" using command down
key code 3 using {command down, option down}
end tell
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment