Jump to content

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

Wikipedia @ click?


  • Please log in to reply
4 replies to this topic
Ace_NoOne
  • Members
  • 299 posts
  • Last active: May 02 2008 08:19 AM
  • Joined: 10 Oct 2005
Hello everyone,

a friend just told me that Babylon Translator now offers a glossary that's connected to Wikipedia.
This means that you just have to middle-click any word or phrase and Babylon will display the respective Wikipedia article:
Posted Image

So I thought, why spend 50 $ on Babylon; this can be done with AHK as well - or can it?
Here's what I think the program should do:[*:gn6am669]First, middle-clicking a word or phrase marks it as the keyword to look for. This means there needs to be a way to somehow recognize the text under the mouse pointer.
(I've considered using copy & paste for this - mark the phrase, then middle-click to copy the word/phrase to the clipboard - but not all programs use the same hotkey for that... :( )
[*:gn6am669]Then, the appropriate URL is composed (e.g. http://en.wikipedia.org/wiki/%keyword%).*
[*:gn6am669]Finally, the contents of that website (or part of it) should be displayed in a small window (similiar to that screenshot above). Opening the URL in the web browser would pretty much obviate the need for a program like this.
However, writing a HTML parser is obviously not an option - maybe the existing IE rendering engine could be used (never done that before)? Otherwise, all the HTML tags would have to be stripped and the contents displayed as plain text...* This means that not only Wikipedia, but any website with the keyword(s) in the URL could be accessed (cf. Firefox's quick searches)!?

Sounds like a good idea? Any suggestions on how to best translate this idea into AHK code? (I'm currently working on a little proof-of-concept script to see what can and can't be done - and how much effort it'd require.)

btw: I hope there aren't any copyright issues in accessing a website like that!?


PS: What would be a good name for such a script/program? I've thought of something like Information@click, but that's a little too corny I guess...

polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012
This checks up any word under the mouse cursor with Answers.com (it only works if text can be highlighted):
MButton::

clipx := clipboard

MouseClick, Left, , , 2

Send, ^c

Run, http://www.answers.com/main/ntquery?s=%clipboard%

clipboard := clipx

Return

autohotkey.com/net Site Manager

 

Contact me by email (polyethene at autohotkey.net) or message tidbit


Laszlo
  • Moderators
  • 4713 posts
  • Last active: Mar 31 2012 03:17 AM
  • Joined: 14 Feb 2005
Titan, Titan, do you say everything twice, do you say everything twice?

We discussed it a year ago. The client of Answers.com does not use the clipboard, it detects if a longer phrase is selected, it works, when double click does not select text, etc. It probably uses some accesibility tools, and it is quite sophisticated. We can only program a much simpler variant in AHK.

polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012
I think I must've double clicked 'Submit' causing the duplicate post, I apologize :(

I've checked my script to see if the word under the mouse cursor can be captured with a double click and a Ctrl+c, and it works fine! Try changing the URL in my above script to something like http://google.com/search?q= and you will get the same result in a google search.

autohotkey.com/net Site Manager

 

Contact me by email (polyethene at autohotkey.net) or message tidbit


PhiLho
  • Moderators
  • 6850 posts
  • Last active: Jan 02 2012 10:09 PM
  • Joined: 27 Dec 2005
Alternative solution (not quite the same as what you are thinking, I know):
use Firefox and its Mycrof extension (integrated in FF 1.5). I have Wikipedia and Merriam-Webster in there. Althought I forget it and click on the M-W button on my personal toolbar :lol:
Posted Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")