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

Send highlighted words/phrases to Google Desktop Apps
I'm sure by now that you've had the chance to download Google Desktop (GD) and compare it to Spotlight. I am also sure that most people that have used GD can note many improvements, such as the ability to activate GD by highlighting a word or phrase in any application and then using a contextual menu or hotkey to bring up GD to perform a search and return the results.

Well, since I am not yet able to put it into a contextual menu, I have chosen to use Butler to set up a smart item keystroke -- along with writing an AppleScript -- that will allow me to select a word or phrase from any application and then send it to GD for matching results. In order for the script to work, you must check 'Enable access for assistive devices' in the Universal Access System Preferences panel. I am sure it can also be done with other browsers, but I choose Safari (default browser) in this case.

First, I set up a container in Butler and then added a Keystrokes Smart Item to it. I gave the container a hotkey (Control-G in my case). For the Keys section of the Keystrokes Smart Item, I entered Command-C (by typing an actual Command-C). Second, I created the following script, saved it as an application, and placed it inside the container -- underneath the Keystrokes Smart Item I created earlier.

Here is the code:
tell application "Google Desktop"
  open desktop homepage
  delay 3
end tell
tell application "Safari"
  activate
  set this_search to "document.forms[0].elements[0].value="
  set escquotes to """
  set thevalue to "'" & escquotes & (the clipboard) & escquotes & "'"
  set mysearch to this_search & thevalue
  do JavaScript mysearch in document 1
end tell
tell application "System Events"
  delay 1
  keystroke return
end tell
Third, I clicked on the container I just created and in the Hot Key section, I chose Launches all children sequentially from the drop down menu. That's pretty much it.

You might have to play around with the delay times in the code to optimize the performance of the script, depending on the machine you are using and your typical CPU load. By default, the script will search for a phrase if you highlight more than one word; otherwise, it will search for a word.

If you wish to search multiple words instead of the phrase, simply remove the [escquotes] bits from the script. Alternatively, you could remove the quotes after the initial results are returned, or simply modify the script to handle both cases using a dialog box. You could also just create another script without the [escquotes], so that you could handle both cases. There are many ways to do this to suit your needs.

Now, any time I want to send a highlighted word or phrase to GD, I just simply invoke the script via a hotkey and I'm done.

[robg adds: I haven't tested this one...]
    •    
  • Currently 2.50 / 5
  You rated: 5 / 5 (6 votes cast)
 
[7,097 views]  

Send highlighted words/phrases to Google Desktop | 5 comments | Create New Account
Click here to return to the 'Send highlighted words/phrases to Google Desktop' hint
The following comments are owned by whoever posted them. This site is not responsible for what they say.
Send highlighted words/phrases to Google Desktop
Authored by: r00st3r on May 15, '07 09:30:31AM

In 10.4, you can highlight text and then using the services menu send that to spotlight. There is also a keyboard shortcut of SHIFT+APPLE+F.

--

POP! goes my heart



[ Reply to This | # ]
Send highlighted words/phrases to Google Desktop
Authored by: roncross@cox.net on May 15, '07 09:51:58AM

Spotlight doesn't do phrases and there is no service for it yet.

---
rlc



[ Reply to This | # ]
Send highlighted words/phrases to Google Desktop
Authored by: drmacnut on May 15, '07 01:50:08PM

ůmany improvements, such as the ability to activate GD by highlighting a word or phrase in any application and then using a contextual menu or hotkey to bring up GD to perform a search and return the results.

The same can be done with Spotlight. I can highlight a word or phrase in Safari, TextEdit, NisusWriter, or any other OS X native app, and using right-click/control-click, I get a contextual menu with the option to "Search in Spotlight". This brings up the standard Spotlight Search window, not the menu extra (blue Spotlight icon).

One of the weak points with Spotlight, however, is of course doing decent phrase searches. Perhaps GD does this better, but I never really found GD to be terribly useful, and rather found that its constant indexing to be a pain in the CPU. ;)

[ Reply to This | # ]
Send highlighted words/phrases to Google Desktop
Authored by: roncross@cox.net on May 15, '07 02:03:23PM

The other advantage that GD has over spotlight is that it indexes the web sites that you been to so you can return to them later.

I know a lot of people have been experiencing problem with GD indexing but most have been able to solve their problem by uninstalling and reinstalling the application. In addition, I am not sure if this problem is isolated to intel vs PPC chips.

---
rlc



[ Reply to This | # ]
Send highlighted words/phrases to Google Desktop
Authored by: stewarsh on May 17, '07 06:24:28PM

This doesn't directly relate to the hint, and for that please excuse me, but I wanted to warn anyone using GD that you may be jeopardizing any Trade Secret or Confidential data that exists a the system where it is installed.

Previous versions were sending portions of search results to Google servers. This would legally invalidate any Trade Secret protection on that document as Google has never signed an NDA with you. This may have been fixed, but I know my company still bans the use of GD for that reason as the previous issues were also undisclosed.

Thanks and sorry for being off-topic.



[ Reply to This | # ]