AutoHotkey Community

It is currently May 27th, 2012, 2:15 am

All times are UTC [ DST ]




Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2
Author Message
 Post subject:
PostPosted: September 14th, 2005, 10:52 am 
Offline

Joined: August 24th, 2005, 5:17 pm
Posts: 1237
delta, I like your script, just haven't had a chance to have much of a look at it so hadn't commented :-)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 18th, 2005, 12:18 am 
Offline

Joined: March 24th, 2005, 11:50 am
Posts: 398
Location: germany
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 :)


Code:
; _______________________________________________________
;
;    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



Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 18th, 2005, 1:52 am 
Offline
User avatar

Joined: August 11th, 2004, 1:47 am
Posts: 5347
Location: UK
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.

_________________
GitHubScriptsIronAHK Contact by email not private message.


Report this post
Top
 Profile  
Reply with quote  
 Post subject: Re: Tool tip dictionary
PostPosted: September 20th, 2005, 10:35 am 
Offline

Joined: January 23rd, 2005, 11:38 am
Posts: 46
@delta

Your script fulfills one of my issues :)
http://borumat.de/autohotkey-autotexte- ... 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:
Code:
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/

_________________
Andreas

http://borumat.de/autohotkey-autotexte-und-makros-tipps (german)
http://borumat.de/thunderbird-email-tipps (german)
http://borumat.de/firefox-browser-tipps (german)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 20th, 2005, 11:36 am 
Offline

Joined: March 24th, 2005, 11:50 am
Posts: 398
Location: germany
@Andreas
Quote:
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.

Quote:
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 20th, 2005, 11:56 am 
Offline

Joined: January 23rd, 2005, 11:38 am
Posts: 46
@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?

_________________
Andreas

http://borumat.de/autohotkey-autotexte-und-makros-tipps (german)
http://borumat.de/thunderbird-email-tipps (german)
http://borumat.de/firefox-browser-tipps (german)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: September 24th, 2005, 10:39 am 
Offline

Joined: July 26th, 2004, 9:07 pm
Posts: 62
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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 1st, 2005, 3:50 pm 
Offline

Joined: August 4th, 2005, 3:56 pm
Posts: 41
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!

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


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: June 2nd, 2006, 1:29 pm 
Offline

Joined: October 10th, 2005, 10:44 am
Posts: 299
Location: Germany
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!?


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: November 2nd, 2007, 12:15 pm 
Offline

Joined: June 7th, 2007, 1:33 pm
Posts: 1019
is this working?


Report this post
Top
 Profile  
Reply with quote  
 Post subject: bravo et merçi
PostPosted: September 11th, 2008, 10:10 am 
Offline

Joined: March 27th, 2008, 7:46 pm
Posts: 129
Location: France
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

Code:
; _______________________________________________________
;
;    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
   ; _______________________________________________________


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 9th, 2008, 6:23 pm 
Offline

Joined: July 26th, 2004, 9:07 pm
Posts: 62
It would be possible now that there is Google Translator, use this url that translates much better?
http://translate.google.com/
Thankyou.

_________________
Loriss


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: October 14th, 2008, 3:15 pm 
Loriss wrote:
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


Report this post
Top
  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 28 posts ]  Go to page Previous  1, 2

All times are UTC [ DST ]


Who is online

Users browsing this forum: MSN [Bot], notsoobvious and 9 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group