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
  • Hi Nora,

    I tried to use control names like this in the past and found that the name of a control can unexpectedly change from one Studio invocation to the next (on the same computer) for no apparent reason.

    Kelly started a thread a while ago where control names also came up. (I unfortunately can't find the thread any more. )

    He is persistent, so if there is a solution to the changing names problem he might have found it :-)
  • Just upgraded to Trados Studio 2017 and hardly none of my AutoHotkey scripts were working!
    Control names and shortcuts have changed in Studio 2017 so I'm changing my AutoHotkey scripts…
  • Hi Jesus,

    I remember a colleague mentioning this; he's also an AHK user and said he had to update many of his scripts. When Studio 2015 first came out, I remember losing a couple of shortcuts because of the ribbon implementation, such as Alt-E that I used to copy source to segment.

    Luckily for me I didn't start using AHK until recently, so all my scripts have been developed in the Studio 2017 environment and in fact I have been able to reclaim Alt-E, which I now use for an AHK script to copy source to target and confirm.

    Good luck with all the changes!
  • An old thread, but anyway I wanted to show how I change languages in the FILE View.

    #IfWinActive ahk_exe SDLTradosStudio.exe
    ; ----------------------------------
    ; Change language in FILE View
    ; ----------------------------------
    XButton1::
    XButton2::
        DetectHiddenText, Off
        WinGetText, ALLTEXT, A
        MouseGetPos, x, y ; Starting position of the mouse    
        ; Mouse in File View
        if (InStr(ALLTEXT,"Carpetas de proyecto") or InStr(ALLTEXT,"Project folders"))
        {
            ChangeLanguage()
            MouseMove, x, y    ; mouse pointer to starting coordinates
        }
    return

    ChangeLanguage()
    {
        static UpDown
        
        CoordMode, Mouse, Client
        Click, 92, 202 ; Language Listbox coordinates
        Sleep, 200
        
        UpDown := !UpDown
        if UpDown
            SendInput {Down}{Enter} ; Language down
        else
            SendInput {Up}{Enter} ; Language up
    }

    #IfWinActive

     

    Notes:

    • The script works in any version of Trados Studio, but only in English and Spanish user interfaces. If you work with another UI, just edit the line with InStr function to your convenience.
    • For simplicity, this script uses the 4th and 5th mouse buttons (back and forth wheel buttons), but you can also add the following hotkeys:
      ^WheelDown:: ; CTRL + WheelDown
      ^WheelUp:: ; CTRL + WheelUp
      PGUP:: ; Page up
      PGDN:: ; Page Down
      To the shown hotkeys:
      XButton1::
      XButton2::
Reply
  • An old thread, but anyway I wanted to show how I change languages in the FILE View.

    #IfWinActive ahk_exe SDLTradosStudio.exe
    ; ----------------------------------
    ; Change language in FILE View
    ; ----------------------------------
    XButton1::
    XButton2::
        DetectHiddenText, Off
        WinGetText, ALLTEXT, A
        MouseGetPos, x, y ; Starting position of the mouse    
        ; Mouse in File View
        if (InStr(ALLTEXT,"Carpetas de proyecto") or InStr(ALLTEXT,"Project folders"))
        {
            ChangeLanguage()
            MouseMove, x, y    ; mouse pointer to starting coordinates
        }
    return

    ChangeLanguage()
    {
        static UpDown
        
        CoordMode, Mouse, Client
        Click, 92, 202 ; Language Listbox coordinates
        Sleep, 200
        
        UpDown := !UpDown
        if UpDown
            SendInput {Down}{Enter} ; Language down
        else
            SendInput {Up}{Enter} ; Language up
    }

    #IfWinActive

     

    Notes:

    • The script works in any version of Trados Studio, but only in English and Spanish user interfaces. If you work with another UI, just edit the line with InStr function to your convenience.
    • For simplicity, this script uses the 4th and 5th mouse buttons (back and forth wheel buttons), but you can also add the following hotkeys:
      ^WheelDown:: ; CTRL + WheelDown
      ^WheelUp:: ; CTRL + WheelUp
      PGUP:: ; Page up
      PGDN:: ; Page Down
      To the shown hotkeys:
      XButton1::
      XButton2::
Children