Submit Hint Search The Forums LinksStatsPollsHeadlinesRSS
14,000 hints and counting!

A Search Google contextual menu Apps
In Mac OS X, there's a cool feature that let you search in Google from the contextual menu in a lot of apps (Mail, TextEdit, iCal...) but this features uses Safari instead of your default browser (Firefox in my case). I wanted to be able to do the same with my default browser; read on to see how this was accomplished using OnMyCommand.

OnMyCommand is a program that executes shell scripts and AppleScripts. You can build your own Contextual Menu Items or GUI applications with it. If you don't already have OnMyCommand installed be aware that it logs you out as part of the install process, so save everything first.
  • Download and install OnMyCommand/OMCEdit.
  • Run the OMCEdit application (in /Applications/OMC/).
  • Click on 'Download Commands' in the toolbar and then 'Download.'
  • Click on 'Command Library' in the toolbar.
  • Choose #22 (Search google for) and click on 'Append to Command.' Then click 'Done.'
  • Change the name if you want (in Command Name).
  • Select 'Top Level' in the location drop-down if you don't want a sub-menu, or choose a name for the sub-menu ('In On My Command' is the default).
  • Save the command.
This tool lets you add a lot of useful things to your contextual menus. Here's two other commands I made to do translations using Google Translate.

From any language to French:
open "http://translate.google.fr/translate_t?hl=&ie=UTF-8&text="__OBJ_TEXT__"&sl=auto&tl=fr#"
From any language to English:
open "http://translate.google.fr/translate_t?hl=&ie=UTF-8&text="__OBJ_TEXT__"&sl=auto&tl=en#"


You just need to make a new command (in OMCEdit), add the command in the command field and name it. Those can easily be change to fit the language of your choice. If you want to use a specific browser instead of your default add '-a YourBrowserName' without the quotes before the command.

Example:
open -a FireFox "http://translate.google.fr/translate_t?hl=&ie=UTF-8&text="__OBJ_TEXT__"&sl=auto&tl=en#"
I am using this with Leopard but it should work in Snow Leopard as well.

[crarko adds: I tested these commands in Snow Leopard (10.6.4), and they work as described in some, but not all, applications. The current (2.2) version of OnMyCommand still has some issues with some 64-bit programs, although that seems to be an area that is being worked on. You should be able to make a Service in Automator that performs similar functions.]
    •    
  • Currently 2.50 / 5
  You rated: 3 / 5 (24 votes cast)
 
[8,690 views]  

A Search Google contextual menu | 4 comments | Create New Account
Click here to return to the 'A Search Google contextual menu' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
A Search Google contextual menu
Authored by: renaultssoftware on Aug 23, '10 07:31:36AM

Is there a URL shortening service?

---
http://groups.google.com/group/applescripters/
http://qgf.in/
http://www.kompilesoft.info/



[ Reply to This | # ]
More OnMyCommand URLs
Authored by: FlaSheridn on Aug 23, '10 09:44:07AM

I agree about the awesomeness of OnMyCommand. Here are some more URLs to use with it (note that the Amazon one gives me a kickback :-)

http://books.google.com/books?q=
http://www.consumersearch.com/www/results.html?q=
http://www.imdb.com/find?s=all&q=
http://www.netflix.com/Search?v1=
http://movies.nytimes.com/gst/movies/msearch.html?query=
http://www.amazon.com/s/ref=nb_ss_/002-9615978-8992817?tag=flashsheridsh-20&url=search-alias%3Daps&field-keywords=
http://search.oreilly.com/?submit.x=0&submit.y=0&q=
http://en.wikipedia.org/wiki/



[ Reply to This | # ]
A Search Google contextual menu
Authored by: m3dusa on Nov 17, '10 02:58:05PM

For me, the extra menu-items does not appear in neither Mail nor TextEdit. They appear in Chrome but that really defeats the purpose, since Chrome already has a "search google for". I did ofcourse log out and back in.
Any suggestions?



[ Reply to This | # ]
A Search Google contextual menu
Authored by: petpirepete on Nov 18, '10 11:08:43AM

It works for me but I use Leopard. With Snow Leopard, you can use Automator to add Service:

Here's how you do it. Open Automator, select Service from the popup that appears. At the top of the window, make sure it says "Service receives selected text in any application", and that the 'replaces text' checkbox is off. now add the action Run Shell Script (you can find that in the 'Utilities' section). Leave the shell as /bin/bash, set the 'pass input' pulldown menu to say as arguments, delete the default for-loop text that appears, and enter open -a FireFox "http://www.google.ca/search?q=$1" into the text area. save the service3 with whatever name you like. This service will use Firefox to search for selected text in google. if you want to use a different browser, replace -a FireFox with whatever (-a Camino, -a Opera, -a SeaMonkey). If you want to choose a browser at run time that will take an extra action - ask if you can't figure it out.

Hugo

(Thanks to tw, from this forum topic: http://hintsforums.macworld.com/showthread.php?t=111762 )



[ Reply to This | # ]