Mac: Automator Service for a Google popup

As I was documenting a big amount of source-code today, I ran into the problem of looking up some stuff in the web (OpenGL-SDK docs to be specific) while inside XCode. There may be better ways to do this, but I ended up seeing that service entry in the context-menu and thought – hey, why not make a service to look up that stuff?

Here’s what I found out:

  1. Create a new Automator Service
  2. On the top right, set “Service recieves selected text” in “any application
  3. Drop a “Run AppleScript” from the Actions Library
  4. Add the following text:
    	on run {input, parameters}
    		set theURL to ("" & input & "&go=Go")
    		return theURL
    	end run
  5. Drop a “Website Popup” from the Actions Library and configure it as desired

    I choose size & agent “iPhone” so it’s not too big but readable.

The selected text is searched by google and the first hit is opened (a.k.a. I’m feeling lucky). Good enough for my documentation problems as the service can be mapped to a global shortcut.

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>