AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Fast Translations

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions
View previous topic :: View next topic  
Author Message
savage



Joined: 02 Jul 2004
Posts: 206

PostPosted: Fri Aug 13, 2004 7:46 pm    Post subject: Fast Translations Reply with quote

I work in the textbook department of a college store and my boss often needs to order foreign books, requiring some work in other languages. To make translations in multiple programs a little simpler, I wrote this little script.

You select some text, hit ctrl-right click and pick the language from the menu. It then pops up the translation in a new browser menu.

I'd like to make it download to a file, and then scree scrape the translation out of it and display it in a tooltip text, but that will need to wait a bit. Unless someone figures it out, of course. Hint hint! Wink

Code:

Menu, Translation, Add, Italian-English
Menu, Translation, Add, French-English
Menu, Translation, Add, German-English
Menu, Translation, Add, Spanish-English
Menu, Translation, Add, English-Italian
Menu, Translation, Add, English-French
Menu, Translation, Add, English-German
Menu, Translation, Add, English-Spanish
TransPart1 = http://babel.altavista.com/tr?doit=done&urltext=
TransPart2 = &lp=
TransText =
TransLang =

Italian-English:
TransLang = it_en
return

French-English:
Translang = fr_en
return

German-English:
Translang = de_en
return

Spanish-English:
Translang = es_en
return

English-Italian:
TransLang = en_it
return

English-French:
Translang = en_fr
return

English-German:
Translang = en_de
return

English-Spanish:
Translang = en_es
return

Translate:
    ;UrlDownloadToFile, %TransPart1%%TransText%%TransPart2%%TransLang% , C:\transtemp.hta
    ;Run, C:\transtemp.hta
     Run, iexplore.exe %TransPart1%%TransText%%TransPart2%%TransLang%
return

^Rbutton::
TempString = %clipboard%
Send, ^c
Clipwait
TransText = %clipboard%
Menu, Translation, Show
clipboard = %tempstring%
Gosub, Translate
return
Back to top
View user's profile Send private message AIM Address
David



Joined: 08 Aug 2004
Posts: 25
Location: Lubbock, Texas

PostPosted: Sat Aug 14, 2004 2:17 am    Post subject: Reply with quote

Thanks, savage. Nothing like a real-world example to move newbies like me up the learning curve!

Is this script self-contained? I'm getting this error when I highlight a word and Ctrl-right-click, and am wondering if there's a command or two I should have at the top of the file.

Quote:
Error: Menu does not exist.
Specifically: Translation
115: Menu,Translation,Show
Back to top
View user's profile Send private message
Chris
Site Admin


Joined: 02 Mar 2004
Posts: 10467

PostPosted: Sat Aug 14, 2004 11:19 am    Post subject: Reply with quote

It runs okay as an isolatated script. If you want to merge it into one of your own scripts, you have to merge its auto-execute section with that of your other script's.
Back to top
View user's profile Send private message Send e-mail
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Scripts & Functions All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group