Switch to Target Language After Adding Files to a Project

I wrote the script below to automatically switch to the target language (first in the Dropdown list, so it works great for bilingual projects) after preparing files newly added to an existing project.

After loading the script, you don't need to do anything else, the script will be triggered when you click OK in the Batch Processing window after completing your file preparation, switching to the target language.

Tip: I've noticed that the name of the control (WindowsForms10.COMBOBOX.app.0.29531c8_r9_ad14) is different between my desktop and laptop computers, so you may want to check yours and make the appropriate changes if the script doesn't work on your system.

;–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––-

;Automatically switch to target language after preparing files

;–––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––––-

 

#IfWinActive ahk_exe SDLTradosStudio.exe


~LButton::
IfWinExist, Batch Processing

{

WinWaitClose, Batch Processing

Sleep, 1000
Control, Choose, 2, WindowsForms10.COMBOBOX.app.0.29531c8_r9_ad14, ahk_class WindowsForms10.Window.8.app.0.29531c8_r9_ad1 ; Selects option 2
}

Return

Parents Reply
  • Yes, Nora:

    I use smae hotkeys in several places inside Trados Studio, but as you said, there must be a mechanism to split the scripts. I don't know if there are more, but I use the following 3 ways:

    • WinGetTitle (to grab de name of the active window title)
    WinGetTitle, title, A
    If title="Batch Processing
    {
       ; your code here
    }
    • MouseGetPos (to grab de name of the control where the mouse is on). I use the Window Spy tool to know the name of the needed control.
    MouseGetPos, , , , myControl

    I only use it in a couple of places inside Trados Studio, as control names keep changing ramdomly). Anyway, I hope I have time and post some scripts I use everyday.

    • WinGetText (to grab the visible/all text in the window). Useful to know if I'm in a particular view and the language of the user interface (I keep swapping Spanish and English UI).
    DetectHiddenText, On ; ON = WHOLE text — OFF = visible text
    WinGetText, textALLTEXT, A
    if InStr(textALLTEXT,"Incluir subcarpetas") ; Spanish
            Language := "ES"
    if InStr(textALLTEXT,"Include subfolders") ; English
            Language := "EN"
Children