TermCuts: Trados term viewing/insertion made easier...
Thread poster: Jaroslaw Michalak

Jaroslaw Michalak  Identity Verified
Poland
Local time: 16:46
Member (2004)
English to Polish
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 softwareicon_razz.gif 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]


 

Jaroslaw Michalak  Identity Verified
Poland
Local time: 16:46
Member (2004)
English to Polish
TOPIC STARTER
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  Identity Verified
Local time: 16:46
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?icon_smile.gif

Cheers
GG


 

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

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


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 MultiTermicon_smile.gif ).


 


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

Advanced search







BaccS – Business Accounting Software
Modern desktop project management for freelance translators

BaccS makes it easy for translators to manage their projects, schedule tasks, create invoices, and view highly customizable reports. User-friendly, ProZ.com integration, community-driven development – a few reasons BaccS is trusted by translators!

More info »
Protemos translation business management system
Create your account in minutes, and start working! 3-month trial for agencies, and free for freelancers!

The system lets you keep client/vendor database, with contacts and rates, manage projects and assign jobs to vendors, issue invoices, track payments, store and manage project files, generate business reports on turnover profit per client/manager etc.

More info »



Forums
  • All of ProZ.com
  • Term search
  • Jobs
  • Forums
  • Multiple search