Jump to content

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

Tool tip dictionary


  • Please log in to reply
27 replies to this topic
evl
  • Members
  • 1237 posts
  • Last active: Oct 20 2010 11:41 AM
  • Joined: 24 Aug 2005
delta, I like your script, just haven't had a chance to have much of a look at it so hadn't commented :-)

garath
  • Members
  • 398 posts
  • Last active: Feb 05 2011 10:31 PM
  • Joined: 24 Mar 2005
I like your skript, it helped me a lot, because I still have some problems with the english language. But what I needed was a request from your skript to Babelfish. Here is an example for translation english-german.
Other combinations could be easily implemented.
I used your great Script, and adjusted it to my needs, so thank you :)


; _______________________________________________________ 
; 
;    Usage: Highlight a word or a phrase and press 
;           the middle mouse button to display a 
;           translation retrieved from: 
;                http://babelfish.altavista.com
; 
; _______________________________________________________ 

#UseHook 

; _______________________________________________________ 
; 
;    mousetol:  The final tool tip will vanish if 
;               the mouse is moved more then %moustol% 
;               pixels away from the current position 
; _______________________________________________________ 

mousetol = 3; 

; _______________________________________________________ 


tempfile = tooltipdic.ttd 






; _______________________________________________________ 
; 
;    Actual script start here 
; _______________________________________________________ 

mButton:: 
Begin:

   d = 

      temp = %clipboard% 
      clipboard = 
      Send, ^c 

      If clipboard = 
      { 
         clipboard = %temp% 
         temp = 
         return 
      } 
      Else 
      { 
        lookup = %clipboard% 
        clipboard = %temp% 
        temp = 
      }    
      ToolTip, Retrieving information on "%lookup%"... 


   ; _______________________________________________________ 
   ; 
   ;    Fetch dictionary entry 
   ; _______________________________________________________ 

   FileDelete, %tempfile% 
   URLDownloadToFile, http://babelfish.altavista.com/babelfish/tr?doit=done&urltext=%lookup%`%0D`%0A&lp=en_de&,%tempfile%
   IfNotExist, %tempfile% 
   { 
      ToolTip, Sorry`, connection timed out.`nTry again later. 
      MouseGetPos, X, Y 
      GoTo, ToolTipDelete 
   } 
    
  
    
wordfound = yes
    
   
   Loop, Read, %tempfile% 
   { 
      IfInString, A_LoopReadLine, padding:10px
      { 
         StringTrimLeft, displayed, A_LoopReadLine, 56 
         Zeile = %A_index%
         IfnotInString, A_LoopReadLine, </div>
         {
           
	

           loop
           {
;msgbox, %Anhang%, %tempfile%, %Zeile%
           Zeile+=1
           FileReadLine, Anhang, %tempfile%, %Zeile%
           displayed = %displayed% %Anhang%	
            IfInString, displayed, </div>
                 break
   ;         Zeile+=1
           }
         }
         StringGetPos, trim, displayed, </div>
         StringLeft, displayed, displayed, trim 
         If offset > 0 
            displayed = %displayed%%A_Space%(continued) 
      } 

      IfInString, A_LoopReadLine, not found 
         { 
            wordfound = no 
            break 
         } 

   
   } 
    
   MouseGetPos, X, Y 

   ; _______________________________________________________ 
   ; 
   ;    Output found words
   ; _______________________________________________________ 

    
   full_entry = %displayed%
   If wordfound = yes 
   { 
       ToolTip, %full_entry% 
   } 
   Else 
     ToolTip, Sorry`, no match found. 
    
   ; _______________________________________________________ 
   ;  
   ;    Wait for mouse movement to delete ToolTip. 
   ;    If there is more to display also detect, if 
   ;    the left mouse button is clicked. 
   ; _______________________________________________________ 
  
   ToolTipDelete: 
  
   Loop 
   { 
     MouseGetPos, Xn, Yn 
     Sleep, 50 
     If (Abs(X - Xn) > mousetol || Abs(Y - Yn) > mousetol) 
        break 
     If more = 1 
     { 
        GetKeyState, LB, LButton 
        If LB = D 
        { 
           more = 0 
           GoTo Begin                   ; Go back and start it all over again 
                                        ; to display the next page 
        } 
     }  
   } 
   offset = 0 
   ToolTip 
    
return 



polyethene
  • Members
  • 5519 posts
  • Last active: May 17 2015 06:39 AM
  • Joined: 26 Oct 2012
I like this script, I found it very useful when reading long articles with jargon I don't understand :p

I changed the hotkey to Ctrl+F1 though.

autohotkey.com/net Site Manager

 

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


Andreas Borutta
  • Members
  • 46 posts
  • Last active: May 04 2010 08:41 AM
  • Joined: 23 Jan 2005
@delta

Your script fulfills one of my issues :)
http://borumat.de/au... ... uebergeben
(german language)

Thank you.

My ideas for improvements:

1 A variable with a clear comment at the top of the script, where a user could declare his target website.
Mine e.g. is:
http://dict.leo.org/?search=%s

2 The motive of most scripts is to be faster
Perfect for this in our situation - searching a selected word - is in my humble opinion a mouse gesture.
The user often uses his mouse to select a word in the middle of a text.
Then, the fastest way to perform a function is: a mouse gesture.

I don't know if a nice GUI to create mouse gestures exists yet.
I think that the extension "mouse gestures" for mozilla could be inspiring:
http://optimoz.mozdev.org/gestures/

garath
  • Members
  • 398 posts
  • Last active: Feb 05 2011 10:31 PM
  • Joined: 24 Mar 2005
@Andreas

I don't know if a nice GUI to create mouse gestures exists yet.

Have a look at the script section, there are several mouse-gesture scripts.

1 A variable with a clear comment at the top of the script, where a user could declare his target website.
Mine e.g. is:

You can change your own version with a gosub Label or variable, and put it at the beginning of the skript.

Andreas Borutta
  • Members
  • 46 posts
  • Last active: May 04 2010 08:41 AM
  • Joined: 23 Jan 2005
@delta

What do you think about a mouse gesture as default for your script?

Because I'm not a programmer:
Would you, or someone else, be so kind to post your script with the suggested variable for the target website?

Loriss
  • Members
  • 62 posts
  • Last active: Oct 09 2008 05:23 PM
  • Joined: 26 Jul 2004
I have found useful to integrate this script With (Auto copy selected test to clipbord, thanks pwy), so that pressing CTRL and evidencing the text with the left mouse , to the release of the mouse, the translation appears.
However there is the problem that for text with many words ,the tooltip with translation, is looked at on a single line, and can be seen only little words.
I do not know for other languages, but the translation English-Italian, Italian-English, on babelfish is terrifying.

I have try on the situated one of Google, but the translate text turns out of all equal, precise one to that one translate with Altavista-babelfish. Evidently they use the same one to sofware.
Is possible find better translation?
Thanks.
Loriss

Harrie
  • Members
  • 41 posts
  • Last active: Dec 13 2007 04:25 PM
  • Joined: 04 Aug 2005
This is just so tremendous! I love this script! I inserted the below to make it automatically select the last word and the tool tip just comes right up, it's so neat. I really thank you for this script. I'd like to make it so that the tool tip gets taken away when you hit the end key, too. (Me, I'm a mouse hater). Anyway, this one put a smile on my face!

^!s:: ; Set this shortcut key
 {
    clipboard =  
 Send, +^{LEFT} 
 Send, ^c
}


Ace_NoOne
  • Members
  • 299 posts
  • Last active: May 02 2008 08:19 AM
  • Joined: 10 Oct 2005
This looks very interesting indeed - a good alternative to Babylon Translator*!
However I can't try it atm cuz a proxy is required for the connection to work... :(

* I never used Babylon's own dictionaries anyway and went for the WordNet glossary as my primary source. As that is freely available AFAIK (at least it's used in a number of tools, e.g. WordWeb), it might be incorporated here!?

azure
  • Members
  • 1216 posts
  • Last active: Mar 18 2015 09:06 AM
  • Joined: 07 Jun 2007
is this working?

soggos
  • Members
  • 129 posts
  • Last active: Nov 30 2012 10:35 AM
  • Joined: 27 Mar 2008
oh yes great thank :) dictionnary run good
and script's garath is so génial grand merçi !)
Voiçi the french version of garat's script for traduction English > French

; _______________________________________________________
;
;    Usage: Highlight a word or a phrase and press
;           the middle mouse button to display a
;           translation retrieved from:
;                http://babelfish.altavista.com  --> en_fr
;
; _______________________________________________________

#UseHook

; _______________________________________________________
;
;    mousetol:  The final tool tip will vanish if
;               the mouse is moved more then %moustol%
;               pixels away from the current position
; _______________________________________________________

mousetol = 30;

; _______________________________________________________

tempfile = tooltipdic.ttd.htm

; ______________________________________________________
;
;    Actual script start here
; _______________________________________________________

mButton::
Begin:

   d =

TransPart1 = http://babel.altavista.com/tr?doit=done&urltext=
TransPart2 = &lp=
Translang = en_fr
TempString = %clipboard%
Send , ^c
Clipwait
TransText = %clipboard%
clipboard = %tempstring%

      ; temp = %clipboard%
      ; clipboard =
      ; Send, ^c

      ; If clipboard =
      ; {
         ; clipboard = %temp%
         ; temp =
         ; return
      ; }
      ; Else
      ; {
        ; lookup = %clipboard%
        ; clipboard = %temp%
        ; temp =
      ; }   
      ToolTip, TRAduction en cours!	; "%TransText%"...

   ; _______________________________________________________
   ;
   ;    Fetch dictionary entry
   ; _______________________________________________________

   FileDelete, %tempfile%
   URLDownloadToFile , %TransPart1%%TransText%%TransPart2%%TransLang%, %tempfile%
   ; URLDownloadToFile, http://babelfish.altavista.com/babelfish/tr?doit=done&urltext=%lookup%&lp=en_fr&,%tempfile%
   IfNotExist, %tempfile%
   {
      ToolTip, Sorry`, connection timed out.`nTry again later.
      MouseGetPos, X, Y
      GoTo, ToolTipDelete
   }


wordfound = yes
   
   
   Loop, Read, %tempfile%
   {
      IfInString, A_LoopReadLine, padding:0.6em
      {
         StringTrimLeft, displayed, A_LoopReadLine, 49
         Zeile = %A_index%
;msgbox, %Anhang%, %tempfile%, %Zeile%
         IfnotInString, A_LoopReadLine, </div>
         {
         loop
           {
           Zeile+=1
           FileReadLine, Anhang, %tempfile%, %Zeile%
		   
           displayed =%displayed%. %Anhang%
		   
		   
            IfInString, displayed, </div>
                 break
   ;         Zeile+=1
           }
         }
         StringGetPos, trim, displayed, </div>
         StringLeft, displayed, displayed, trim
         If offset > 0
            displayed = %displayed%%A_Space%(continued)
      }

      IfInString, A_LoopReadLine, not found
         {
            wordfound = no
            break
         }

   
   }
   
   MouseGetPos, X, Y
stringreplace , displayed, displayed, `.%A_SPACE% , `.`n, All


   ; _______________________________________________________
   ;
   ;    Output found words
   ; _______________________________________________________

   
   full_entry = %displayed%
   If wordfound = yes
   {
Tooltip %full_entry%

   }
   Else
     ToolTip, Sorry`, no match found.
   
   ; _______________________________________________________
   ; 
   ;    Wait for mouse movement to delete ToolTip.
   ;    If there is more to display also detect, if
   ;    the left mouse button is clicked.
   ; _______________________________________________________
 
 
   ToolTipDelete:
 
   Loop
   {
     MouseGetPos, Xn, Yn
     Sleep, 50
     If (Abs(X - Xn) > mousetol || Abs(Y - Yn) > mousetol)
        break
     If more = 1
     {
        GetKeyState, LB, LButton
        If LB = D
        {
           more = 0
           GoTo Begin                   ; Go back and start it all over again
                                        ; to display the next page
        }
     } 
   }
   offset = 0
   ToolTip
   
return
   ; _______________________________________________________


Loriss
  • Members
  • 62 posts
  • Last active: Oct 09 2008 05:23 PM
  • Joined: 26 Jul 2004
It would be possible now that there is Google Translator, use this url that translates much better?
http://translate.google.com/
Thankyou.
Loriss

KGC
  • Guests
  • Last active:
  • Joined: --

It would be possible now that there is Google Translator, use this url that translates much better?
http://translate.google.com/
Thankyou.


Could you customize this code to see the translation from Russian to English which uses google translator.

Kgc