home *** CD-ROM | disk | FTP | other *** search
- /*
-
- -------------------------------------
- Yam Translator By FTranslator Client
-
- Script by Cristian Robert Gallas
-
- Tested on Yam 2.0 preview 5
- Usage:
- Use in ARexx interface of Yam
- $VER: FTransYAM.rexx v1.0 (25.09.99)
- -------------------------------------
-
- HISTORY
- ----------------------------------------
- v0.01b [16.08.98] - First public beta version.
- v1.0 [25.09.99] - Modified to FTrans 1.2 API;
- ----------------------------------------
-
- [Steps installation]
-
- > Copy FTransYAM.rexx to Yam:Rexx/
- > Go to Yam Configuration
- > Select ARexx folder
- > Select 'Scripts' menu entry X
- > Name --> Port->Eng (example: Portugues to English)
- > Script --> Yam:Rexx/FTransYam.rexx 3 mail (3 is a translation direction)
- OBS: mail = open translation in writemail window
- request = open translation in request window
- > Select ARexx on combobox
- > Don`t select
- Open console window
- Wait for termination
- > Select text and select on menu Port->Eng and see! :)
-
- 0 - English to Francais
- 1 - English to Deutsch
- 2 - English to Italiano
- 3 - English to Portugues
- 4 - English to Espanol
- 5 - Francais to English
- 6 - Deutsch to English
- 7 - Italiano to English
- 8 - Espanol to English
- 9 - Portugues to English
-
- */
-
- Options Results
-
- tmpfile = 'Ram:FTransTmp.YAM'
- tmpclip = 'Ram:FTransYam.Clip'
-
- ARG traduz opcao
-
- /* TESTA SE PODE SER USADAS AS LIBS DO AREXX */
- if ~show(l, "rexxsupport.library") then
- if ~addlib("rexxsupport.library", 0, -30) then
- exit
- if ~show(l, "rexxtricks.library") then
- if ~addlib("rexxtricks.library", 0, -30) then
- exit
-
- /* TESTA SE O PROGRAMA JA NAO ESTA COM A PORTA DE TRADUCAO ABERTA */
- if exists(tmpfile) then do
- Request '"FTranslation port is open! Translation in progress, wait..." "_Ok"'
- exit
- end
-
- /* COLOCA COMO DEFAULT PORTUGUES TO ENGLISH */
- if traduz = "" then
- traduz = 3
-
- /* PEGA O CONTEUDO DO CLIPBOARD */
- sel = ReadClipboard(0)
-
- /* TESTA SE O CLIPBOARD ESTA VAZIO */
- if sel = '' then do
- Request '"You need select text first, clipboard is empty..." "_Ok"'
- exit
- end
-
- call open(1, tmpclip, 'W')
- call writeln(1, sel)
- call close(1)
-
- /* EXECUTA O FTRANSLATOR COM OS ARGUMENTOS DA TRADUCAO */
- comando = 'C:FTranslator -f "'tmpclip'" -d 'traduz' SILENCE > 'tmpfile
- Address Command comando
- call delete(tmpclip)
-
- /* SE USAR A OPCAO DE WRITEMAIL */
- if (opcao = "") | (lower(opcao) = "mail") then do
- MAILWRITE
- WRITELETTER FILE tmpfile
- call delete(tmpfile)
- exit
- end
-
- /* SE USAR A OPCAO DE REQUEST */
- if lower(opcao) = "request" then do
- goodopen=open(1, tmpfile, 'R')
- linein = ''
- if goodopen then do
- do until eof(1)
- linein = linein'*N 'readln(1)
- end
- end
- close(1)
- call delete(tmpfile)
- linein = compress(linein, '"')
- Request '" 'linein' " "_Ok"'
- end
-
- exit
-