[HOWTO] -Set Key Sequence/Shortcut WINDOWS

/Hello Ruby fans/

I’m working in an small project to create a translation machine ( basically
English<->Spanish )
I’d love to call this program with a ‘Key-Sequence shortcut’ on Window$,
I have found some ways to do it but I am wondering if there’s a ruby way to set
the shortcut .

THE IDEA IS:
1 - Ctrl-C [ love ]
2 - Key Sequence [Ctrl-Alt Z ]
3 - Ctrl-V [amor]

class TranslateClipBoard

include BabelFish
require “win32/clipboard”

def initialize
paste(translate(copy))
end

def copy
clp = Win32::Clipboard.data
return clp
end

def paste(data)
     Win32::Clipboard.data = data
end

def translate(text)	            
  res = BabelFish.translate("en_es",text)
  return res 
end   

end

class SetShortCut
# ???
end

*could you recommend me a (SOAP/XML) free translation service on the web to
suck the data from ?

Thanks -> Gracias

---- Msg sent via Spymac Mail - http://www.spymac.com

Ronnie Bermejo wrote:

/Hello Ruby fans/

I’m working in an small project to create a translation machine ( basically
English<->Spanish )
I’d love to call this program with a ‘Key-Sequence shortcut’ on Window$,
I have found some ways to do it but I am wondering if there’s a ruby way to set
the shortcut .

THE IDEA IS:
1 - Ctrl-C [ love ]
2 - Key Sequence [Ctrl-Alt Z ]
3 - Ctrl-V [amor]

[snip]

class SetShortCut
# ???
end

Unable to follow :frowning:

Ctrl-C copies highlighted English word to c/bd
Ctrl+Alt-Z starts ruby script to translate word in c/bd and
sets a k/bd shortcut to what? … itself?

If you create a fixed shortcut(link) to your script, e.g. to
C:\ruby\mystuff\babelfish.rb
you can add a shortcut key (Ctrl+Alt-Z) from the “Properties” page.

*could you recommend me a (SOAP/XML) free translation service on the web to
suck the data from ?

Thanks -> Gracias

Can’t recommend, but isn’t babelfish free?


from http://www.perfectxml.com/articles/xml/interop.asp

Description of services used as examples:

Service: BabelFish translation

Description: Translates a text up to 5K in size.
Inputs: Translation mode [“en_fr”, “en_de”, “en_it”, “en_pt”, “en_es”,
“fr_en”, “de_en”, “it_en”, “pt_en”, “ru_en”, “es_en”];
string to be translated in source language.
Output: Translation in target language.
WSDL: yes
SOAP Implementation: SOAP::Lite


daz