Services – Google Text in Firefox
Thursday, September 3rd, 2009
I created a Service within Automator in Snow Leopard to allow you to search any text in Google through Firefox. As a Firefox user I hardly ever go into Safari to do any browsing. So whenever I use Apple’s nice Search in Google contextual menu, of course, it opens up in Safari. Here is the video I created showing and demoing how its done.
Watch in HD and in Full Screen!
The code to do this is below, just copy and paste it in the AppleScript Workflow in Automator.
on run {input, parameters}
set UrlBase to "http://www.google.com/search?q=" -- Set the base search URL for google.
set Search to (input as text) -- Getting the text that was selected and storing it in the variable Search.
set UrlAddr to UrlBase & Search as string -- Set complete URL.
activate application "Firefox" -- Launching Firefox or waking it if its already open.
tell application "System Events"
keystroke "l" using {command down} -- Highlight the URL field.
keystroke UrlAddr & return -- Type in the URL + a return.
end tell
end run
If you have any questions on how this was done, or if you run into any problems, feel free do leave a comment and I’ll help you.

Thanks for the post with video. Just a note, I changed mine to perform a Command-T instead of Command-L. Command-L just goes to the Address Bar, and will navigate away from the current page. Command-T, though, will open a new tab, and position the cursor in the Address Bar for that new tab.
[...] This post was Twitted by DasutinD [...]