TermCuts: Trados term viewing/insertion made easier...
Thread poster: Jaroslaw Michalak
Jaroslaw Michalak
Jaroslaw Michalak  Identity Verified
Poland
Local time: 08:23
Member (2004)
English to Polish
SITE LOCALIZER
Apr 27, 2009

Inspired by the discussion in this thread:

http://www.proz.com/forum/sdl_trados_support/133592-how_to_save_as_utf_8-page2.html

I have whipped up a small script for Autohotkey, which presents the found terms in a nice window, and allows to insert them with a single shortcut (Alt+number in the first column).



The script takes the default Open segment shortcut (Alt+Home), naturally you can change it, but then also change the sequence sent after that (so that TagEditor/Word responds correctly).

It took me about four hours, imagine what a real programmer could do with that software Naturally, all comments and suggestions are welcome. (BTW, I tried to make the columns resize automatically when the window is resized, but could not do that... Too little experience with AHK GUI, I'm afraid...).

Here's the code:

Code:

; TermCuts ver. 1.0
; Author: Jaroslaw Michalak
;
; Script Function:
; Display and insert terms from Multiterm
;
#Include ws4ahk.ahk

WS_Initialize()

WS_Exec("Set oWorkbench = GetObject(, ""TW4Win.Application"" )" )

Gui +Resize
Gui, Add, ListView, xm r15 w440 vMyListView gMyListView, #|Source|Target
Gui, Show
LV_ModifyCol(1, 30)
LV_ModifyCol(2, 200)
LV_ModifyCol(3, 200)


!Home::
Send !{home}
sleep 3000
; The sleep command is necessary, as MultiTerm is not very fast...
; The exact value depends on the termbase size, I suppose, so
; you might lower the value if you see that you get the terms in
; WB faster than in the AHK window.

LV_Delete()
WS_Eval(count, "oWorkbench.TranslationMemory.TranslationUnit.TermCount" )

Loop %count% {

WS_Eval(found, "oWorkbench.TranslationMemory.TranslationUnit.Term.Found" )
WS_Eval(target, "oWorkbench.TranslationMemory.TranslationUnit.Term.Target" )
LV_Add("", A_Index, found, target)
WS_Exec("oWorkbench.TranslationMemory.TranslationUnit.Term.Next" )

}
return

!1::
LV_GetText(Inserted, 1, 3)
Send %Inserted%
return

!2::
LV_GetText(Inserted, 2, 3)
Send %Inserted%
return

!3::
LV_GetText(Inserted, 3, 3)
Send %Inserted%
return

!4::
LV_GetText(Inserted, 4, 3)
Send %Inserted%
return

!5::
LV_GetText(Inserted, 5, 3)
Send %Inserted%
return

!6::
LV_GetText(Inserted, 6, 3)
Send %Inserted%
return

!7::
LV_GetText(Inserted, 7, 3)
Send %Inserted%
return

!8::
LV_GetText(Inserted, 8, 3)
Send %Inserted%
return

!9::
LV_GetText(Inserted, 9, 3)
Send %Inserted%
return


MyListView:
return


GuiSize: ; Expand or shrink the ListView in response to the user's resizing of the window.
if A_EventInfo = 1 ; The window has been minimized. No action needed.
return
; Otherwise, the window has been resized or maximized. Resize the ListView to match.
GuiControl, Move, MyListView, % "W" . (A_GuiWidth - 20) . " H" . (A_GuiHeight - 40)
return




[Edited at 2009-04-27 15:13 GMT]
Collapse


 
Jaroslaw Michalak
Jaroslaw Michalak  Identity Verified
Poland
Local time: 08:23
Member (2004)
English to Polish
TOPIC STARTER
SITE LOCALIZER
Required script... Apr 27, 2009

Forgot to add that you need to download the ws4ahk.ahk script from here:

http://www.autohotkey.net/~easycom/

and put it with my script (or specify full path in the #include directive).


 
Grzegorz Gryc
Grzegorz Gryc  Identity Verified
Local time: 08:23
French to Polish
+ ...
Wow... Apr 27, 2009

Jabberwock wrote:

Forgot to add that you need to download the ws4ahk.ahk script from here:

http://www.autohotkey.net/~easycom/

and put it with my script (or specify full path in the #include directive).


Well, well...
It takes years Trados/Multiterm programmers were unable to switch to the term list view...

PS.
How many time you spent to write it?

Cheers
GG


 
Jaroslaw Michalak
Jaroslaw Michalak  Identity Verified
Poland
Local time: 08:23
Member (2004)
English to Polish
TOPIC STARTER
SITE LOCALIZER
Not too long... Apr 27, 2009

Grzegorz Gryc wrote:
How many time you spent to write it?


As I wrote, it took about four hours, most of which I spent working out the intricacies of using Windows objects in AHK and getting to know the ListView options. I did not want to bother with Visual Basic or .Net Express, as it requires some bloatware, although it would be faster there.

Also, I have copped out by copying and replacing the number key code, I guess a loop would have been much more elegant, but as it was faster and it works, you cannot really blame me (blame MultiTerm ).


 
Michael Beijer
Michael Beijer  Identity Verified
United Kingdom
Local time: 07:23
Member (2009)
Dutch to English
+ ...
ws4ahk.ahk moved Oct 1, 2019

Jaroslaw Michalak wrote:

Forgot to add that you need to download the ws4ahk.ahk script from here:

http://www.autohotkey.net/~easycom/

and put it with my script (or specify full path in the #include directive).


ws4ahk.ahk is now here: https://github.com/m35/ws4ahk


 


To report site rules violations or get help, contact a site moderator:


You can also contact site staff by submitting a support request »

TermCuts: Trados term viewing/insertion made easier...







Wordfast Pro
Translation Memory Software for Any Platform

Exclusive discount for ProZ.com users! Save over 13% when purchasing Wordfast Pro through ProZ.com. Wordfast is the world's #1 provider of platform-independent Translation Memory software. Consistently ranked the most user-friendly and highest value

Buy now! »
CafeTran Espresso
You've never met a CAT tool this clever!

Translate faster & easier, using a sophisticated CAT tool built by a translator / developer. Accept jobs from clients who use Trados, MemoQ, Wordfast & major CAT tools. Download and start using CafeTran Espresso -- for free

Buy now! »