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!

  • Many thanks again Jesus,
    This hasn'e got me up and running yet, but am on the way! Will keep experimenting.
  • Hi again Jesus,
    I hope you can help me again. I have tried a few things, and thought I had the monkey by the tail, but I can't get the 'Close' stage to process in the Batch processing 'Finish' window. When I manually click on Close or hit enter the script continues to run. My adaptation of your script looks like this, and everything else works fine:

    #IfWinActive ahk_exe SDLTradosStudio.exe
    ^F5::
    Sleep 600
    Send !h
    Sleep 600
    Send !b
    Sleep 600
    Send {down}
    Sleep 500
    Send {Enter}
    WinWaitActive, Batch Processing
    Send {Enter}
    Sleep 500
    Send {Enter}
    WinWaitActive, Batch Processing ; waiting for the analysis to finish. As this is also a batch processing window, I thought I could use it here too. Or maybe you didn't use it for a reason...
    Send {Enter} ; ... but now I have to do this manually by pressing Enter
    WinWaitActive, Question ; the script now continues successfully
    Send {Enter} ; YES button
    Sleep 5000
    Send ^{Enter}
    Return
    #IfWinActive

    Thanks,

    Olly
Reply
  • Hi again Jesus,
    I hope you can help me again. I have tried a few things, and thought I had the monkey by the tail, but I can't get the 'Close' stage to process in the Batch processing 'Finish' window. When I manually click on Close or hit enter the script continues to run. My adaptation of your script looks like this, and everything else works fine:

    #IfWinActive ahk_exe SDLTradosStudio.exe
    ^F5::
    Sleep 600
    Send !h
    Sleep 600
    Send !b
    Sleep 600
    Send {down}
    Sleep 500
    Send {Enter}
    WinWaitActive, Batch Processing
    Send {Enter}
    Sleep 500
    Send {Enter}
    WinWaitActive, Batch Processing ; waiting for the analysis to finish. As this is also a batch processing window, I thought I could use it here too. Or maybe you didn't use it for a reason...
    Send {Enter} ; ... but now I have to do this manually by pressing Enter
    WinWaitActive, Question ; the script now continues successfully
    Send {Enter} ; YES button
    Sleep 5000
    Send ^{Enter}
    Return
    #IfWinActive

    Thanks,

    Olly
Children