Script for batch tasks

I've been trying to create a script to run batch tasks by emulating the keyboard shortcuts, but I'm getting nowhere. Can anyone point me in the right direction (whichever direction that is)? E.g. I'd like to run Analyse Files, auto-select 'Finish', then 'Close', then 'Yes' (to reopen the file) and then go to first untranslated segment. Maybe trying to reinvent a wheel here?

Thanks,

Olly

Parents
  • If you promise not to laugh... I inserted all the sleeps because my device tends to respond too fast otherwise. The long sleeps are to give Studio time to run the operation. As I said, it does nothing much... One of the many issues might be the focus on the current window (to be able to activate the Finish button using the Enter key)?

    #IfWinActive SDL Trados Studio
    ^a::
    Send !h
    Sleep 50
    Send !b
    Sleep 50
    Send {down}
    Sleep 50
    Send {Enter}
    Sleep 5000
    Send {Enter}
    Sleep 5000
    Send {Enter}
    Sleep 5000
    Send {Enter}
    Sleep 50
    Send !y
    Sleep 50
    Send ^{Enter}
    Return
    #IfWinActive
  • Never mind, Olly. We all started this way.
    This script works for me in an English UI. I commented some lines for your convenience:

    #IfWinActive ahk_exe SDLTradosStudio.exe ; this needs to match the info of Spy tool
    ; WINDOWS + A (change it to your suits)
    #a:: ; I wouldn’t use CONTROL+A to trigger any script
        Send !h
        Sleep 100    
        Send b ; (without ALT works as well)
        Sleep 200
        Send {down 2} ; Down x2, as Down x1 is FINALIZE
        Sleep 50
        Send {Enter}
        WinWaitActive, Batch Processing ; Wait for the BATCH PROCESSING window to show

        Send {Shift down} ; SHIFT + TAB x2 (Focus on FINALIZE button)
        Send {Tab 2}
        Send {Shift up}
        Send {Enter} ; FINALIZE button    

        Sleep 5000 ; Waiting the ANALISYS to finish
        Send {Enter} ; CLOSE button
        
        WinWaitActive, Question ; Wait for the QUESTION window to show
        Send {Enter}  ; YES button
    Return
    #IfWinActive

    If the script doesn’t work, you may want to tune the Sleep timers until it works.

    The only step not automated is waiting for the analysis to finish. I leave it for you...
    :-)
    Tip: WinWaitActive function.
    Good luck!

Reply
  • Never mind, Olly. We all started this way.
    This script works for me in an English UI. I commented some lines for your convenience:

    #IfWinActive ahk_exe SDLTradosStudio.exe ; this needs to match the info of Spy tool
    ; WINDOWS + A (change it to your suits)
    #a:: ; I wouldn’t use CONTROL+A to trigger any script
        Send !h
        Sleep 100    
        Send b ; (without ALT works as well)
        Sleep 200
        Send {down 2} ; Down x2, as Down x1 is FINALIZE
        Sleep 50
        Send {Enter}
        WinWaitActive, Batch Processing ; Wait for the BATCH PROCESSING window to show

        Send {Shift down} ; SHIFT + TAB x2 (Focus on FINALIZE button)
        Send {Tab 2}
        Send {Shift up}
        Send {Enter} ; FINALIZE button    

        Sleep 5000 ; Waiting the ANALISYS to finish
        Send {Enter} ; CLOSE button
        
        WinWaitActive, Question ; Wait for the QUESTION window to show
        Send {Enter}  ; YES button
    Return
    #IfWinActive

    If the script doesn’t work, you may want to tune the Sleep timers until it works.

    The only step not automated is waiting for the analysis to finish. I leave it for you...
    :-)
    Tip: WinWaitActive function.
    Good luck!

Children