Jump to content

Sky Slate Blueberry Blackcurrant Watermelon Strawberry Orange Banana Apple Emerald Chocolate
Photo

Look Up Selected Text Using a Popup Menu of Reference Tools


  • Please log in to reply
70 replies to this topic
aRealHoot
  • Members
  • 10 posts
  • Last active: Oct 03 2006 12:17 AM
  • Joined: 07 Feb 2006
I’ve searched the forums for a script that looks up the selected text using a variety of reference materials. When you run the script that I imagine, a popup menu of available reference tools (such as Google Search, Dictionary.com, and Wikipedia) appears beside the text you selected. You click the reference tool to look up the text. Here are some examples of possible lookups.

Google Search:         http://www.google.com/search?hl=en&q=%clipboard%
Google Images:         http://images.google.com/images?hl=en&%clipboard%
Dictionary.com:        http://www.dictionary.com/search?q=%clipboard%&db=*, , max   
The Free Dictionary:   http://www.thefreedictionary.com/%clipboard%
Wikipedia:             http://en.wikipedia.org/w/wiki.phtml?search=%clipboard%
Columbia Encyclopedia: http://columbia.thefreedictionary.com/%clipboard%
Encarta Encyclopedia:  http://encarta.msn.com/encnet/refpages/search.aspx?q=%clipboard%

Has anybody created such a tool? It sure would be valuable! Thank you.

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
ConQuery :!:
Now, if you don't use Firefox, and don't have something similar for your browser, you are on your own.

Mmm, of course, your idea should work on any application!
OK, it is easy enough to make it.
I will be back soon... Don't change channel! :-)
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
It was fast as I already has the base code to create the menu:
menuReferenceTools =
(
&Google Search
http://www.google.com/search?hl=en&q=@@
Google &Images
http://images.google.com/images?hl=en&@@
&Dictionary.com
http://www.dictionary.com/search?q=@@&db=*, , max
The &Free Dictionary
http://www.thefreedictionary.com/@@
&Merriam-Webster
http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=@@
&Wikipedia
http://en.wikipedia.org/w/wiki.phtml?search=@@
&Columbia Encyclopedia
http://columbia.thefreedictionary.com/@@
&Encarta Encyclopedia
http://encarta.msn.com/encnet/refpages/search.aspx?q=@@
&AutoHotkey manual
http://www.autohotkey.com/docs/commands/@@.htm
)

#+r::
	Send ^c
	Sleep 100
	CreateMenu("mRef", menuReferenceTools, "ReferenceTools")
	Menu mRef, Show
Return

ReferenceTools:
	RunMenuItem(menuReferenceTools, A_ThisMenuItemPos)
Return

CreateMenu(_menuName, _menuDef, _menuLabel)
{
	Loop Parse, _menuDef, `n
	{
		If (Mod(A_Index, 2) = 1) ; Odd
		{
			Menu %_menuName%, Add, %A_LoopField%, %_menuLabel%
		}
	}
}

RunMenuItem(_menuDef, _index)
{
	Loop Parse, _menuDef, `n
	{
		If (_index * 2 = A_Index)
		{
			StringReplace toRun, A_LoopField, @@, %Clipboard%, All
			Run %toRun%
			Break
		}
	}
}
I will add this to my tool box! :-) Thanks for the idea.
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

SuperScripter
  • Members
  • 25 posts
  • Last active: Aug 11 2006 03:34 PM
  • Joined: 31 Mar 2006
& PhiLho does it again, you are a "GodSend"
http://dictionary.re...earch?q=GodSend

Pacheco
  • Members
  • 168 posts
  • Last active: Apr 11 2013 08:21 AM
  • Joined: 23 Feb 2006
This script is amazing.... =D

Thanks PhiLho for publishing it

aRealHoot
  • Members
  • 10 posts
  • Last active: Oct 03 2006 12:17 AM
  • Joined: 07 Feb 2006
Good heavens!

I never expected so fast a response.

PhiLho, you've done exactly what I asked for. You rock!

I made an error in the URL for Google Images, which needs to be corrected in the code. The correct URL is:

http://images.google.com/images?hl=en&q=@@

I have one minor enhancement request: to leave the clipboard undisturbed (that is, to restore the original clipboard contents).

Man, I love this script.

Aybra
  • Members
  • 58 posts
  • Last active: May 30 2008 08:21 PM
  • Joined: 16 May 2006
I prefer this
Run, iexplore.exe %toRun% 

but OMG, i love this thing.

MsgBox
  • Members
  • 204 posts
  • Last active: Jan 05 2011 01:40 AM
  • Joined: 17 Nov 2005
Hi arealhoot

I have one minor enhancement request: to leave the clipboard undisturbed (that is, to restore the original clipboard contents).


This works. :wink:

menuReferenceTools =
(
&Google Search
http://www.google.com/search?hl=en&q=@@
Google &Images
http://images.google.com/images?hl=en&q=@@
&Dictionary.com
http://www.dictionary.com/search?q=@@&db=*, , max
The &Free Dictionary
http://www.thefreedictionary.com/@@
&Merriam-Webster
http://www.m-w.com/cgi-bin/dictionary?book=Dictionary&va=@@
&Wikipedia
http://en.wikipedia.org/w/wiki.phtml?search=@@
&Columbia Encyclopedia
http://columbia.thefreedictionary.com/@@
&Encarta Encyclopedia
http://encarta.msn.com/encnet/refpages/search.aspx?q=@@
&AutoHotkey manual
http://www.autohotkey.com/docs/commands/@@.htm
)

#+r::
   ClipSaved := ClipboardAll
   Clipboard =
   Send ^c
   Sleep 100
   CreateMenu("mRef", menuReferenceTools, "ReferenceTools")
   Menu mRef, Show
   Clipboard := ClipSaved
   ClipSaved =
Return

ReferenceTools:
   RunMenuItem(menuReferenceTools, A_ThisMenuItemPos)
Return

CreateMenu(_menuName, _menuDef, _menuLabel)
{
   Loop Parse, _menuDef, `n
   {
      If (Mod(A_Index, 2) = 1) ; Odd
      {
         Menu %_menuName%, Add, %A_LoopField%, %_menuLabel%
      }
   }
}

RunMenuItem(_menuDef, _index)
{
   Loop Parse, _menuDef, `n
   {
      If (_index * 2 = A_Index)
      {
         StringReplace toRun, A_LoopField, @@, %Clipboard%, All
         Run %toRun%         
         Break
      }
   }
}


PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
Thanks SlimlinE.
I won't change my own version, because I use CLCL, so the previous instances of the clipboard are still easily available! :-)

@Aybra: yuck! :lol:
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

SKAN
  • Administrators
  • 9115 posts
  • Last active:
  • Joined: 26 Dec 2005
Dear PhiLho, :)

I saw this only now.. :shock:

Thats a very nice Utility!

Thanks... Please post it in the Scripts & Functions.

Regards, :)

PS: Even the title of this Topic is very descriptive.
kWo4Lk1.png

Pacheco
  • Members
  • 168 posts
  • Last active: Apr 11 2013 08:21 AM
  • Joined: 23 Feb 2006
Once again thx to PhiLho by posting it, and thx too to SlimlinE by the changes.... Maintaining clipboard as it was sometimes might be important...

Thx guys!!! :)

Guest9657468
  • Guests
  • Last active:
  • Joined: --
How can I use this to search a drive?
I have been looking but can't find a good way to do it.

PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005

How can I use this to search a drive?
I have been looking but can't find a good way to do it.

I am not surprised, because I see no relation between this code and any drive (files & folders?) exploration.
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")

Guest9657468
  • Guests
  • Last active:
  • Joined: --
Well, is there a good way of calling up the Search Window? (using XP / 2000)

This really is a great tool, I'm just trying to make it more powerful.

Thanks

Chris
  • Administrators
  • 10727 posts
  • Last active:
  • Joined: 02 Mar 2004

is there a good way of calling up the Search Window? (using XP / 2000)

Run Find C:\
... or:
Send #f ; Explorer's Win+F hotkey.