Check this out. Have you ever wanted to add functionality to Internet Explorer? Say you want it so that when you have a word selected, you can right click and have it look that word up at http://www.dictionary.com ?

Well here's how you do it. From this you could dream up a bunch of other things I'm certain. Hey, maybe you can create your own cool thing and stick it here too. With Javascript I'd think you could do a ton of things, like maybe...

  • An Ebay item ID lookup script
  • a Yahoo Mail mail sender (now, when you click on a mail address IE will pop you to Outlook or Eudora). In this case, maybe you could take the cursor position and then scan left and right to parse out the email address. Probably more fun to do than useful.
  • ???

For your convenience I put the registry file and HTML file below. Just run the .reg file and put the .htm file in c:\iemenu. Or, learn how it's really done and do these steps...

  1. Launch regedit
  2. Find the key HKEY_CURRENT_USER\Software\Microsoft\Internet Explorer\MenuExt\
  3. Create a new key. In our example, create one called Dictionary
  4. Make the default value for the key equal to file://c:\iemenu\testscript.htm - which is an HTML file which we'll create shortly.
    NOTE: Now, I think with pre-Internet Explorer 5.0 you could just stick a URL there with a substitution string. But I couldn't get this to work. Google's tool bar has a DLL which they install on your machine as the target. The way we'll do it is cooler anyhow.
  5. Create a binary value named Contexts and set it to 30 00 00 00
  6. Ok, we're done in the registry. Close up.
  7. Now create the file c:\iemenu\testscript.htm and make it look like this.
    <SCRIPT LANGUAGE="JavaScript" defer>
    
    str = new String("http://www.dictionary.com/cgi-bin/dict.pl?term=")
    
    var parentwin = external.menuArguments;
    var doc = parentwin.document;
    var sel = doc.selection;
    var rng = sel.createRange();
    var selectedStuff = new String(rng.text);
    str = str + selectedStuff
    parentwin.location = str
    newWin.location = str
    </SCRIPT>
    
  8. Ok, you're done. Try it out!

-- MattWalsh - 18 Dec 2001

Topic attachments
I Attachment Action Size Date Who Comment
HTMLhtm dictionaryScript.htm manage 0.7 K 18 Dec 2001 - 23:28 MattWalsh HTML file for the dictionary lookup
Registry filereg dictionaryScript.reg manage 0.2 K 18 Dec 2001 - 23:30 MattWalsh Registry file for the dictionary lookup
Topic revision: r2 - 13 Feb 2004 - MattWalsh
 
This site is powered by the TWiki collaboration platformCopyright © 2008-2012 by the contributing authors. All material on this collaboration platform is the property of the contributing authors.
Ideas, requests, problems regarding TWiki? Send feedback