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 :-)
  • Thank you Bruce, hopefully there will be a way to figure this out. Unfortunately, my very limited programming knowledge doesn't allow me to fully understand what else could be done to make the behavior more consistent. For example, is there a way to use the ClassNN text in the control (i.e. the language name) to direct the script to click there?

    There's always the option to use mouse coordinates to click on the control, I guess, but of course that wouldn't work for different size monitors.

    At the moment this is working for me as shown above on my main computer, while I have a second script with a different control name for my laptop computer, so it's a rudimentary solution, but it works. : )
Reply
  • Thank you Bruce, hopefully there will be a way to figure this out. Unfortunately, my very limited programming knowledge doesn't allow me to fully understand what else could be done to make the behavior more consistent. For example, is there a way to use the ClassNN text in the control (i.e. the language name) to direct the script to click there?

    There's always the option to use mouse coordinates to click on the control, I guess, but of course that wouldn't work for different size monitors.

    At the moment this is working for me as shown above on my main computer, while I have a second script with a different control name for my laptop computer, so it's a rudimentary solution, but it works. : )
Children