Removing AT statuses as you work

This one has always been a hot topic and I've been fairly opinionated on this in the past, but today there are so many published ways to do this I thought I'd share a simple way of automating the removal of the AT status as you work:

;------------------------------------------------------------------------------
; Clear AT statuses in SDL Trados Studio.
;------------------------------------------------------------------------------
^+f::
Send ^a^c!{Ins}^a^v
Return

The script is simple enough, you just press Ctrl+Shift+f and the AT status from a machine translation magically disappears so the active segment appears to be a new translation for you to post-edit.  The script just automates the selection of the target, copy the target to the clipboard, overwrite the target with the source which clears the AT status, select the target again and paste back the original machine translation.

  • Thank you Paul! I use something slightly different for the same purpose:

    Rwin:: ; removes AT from segment status after post-editing and confirms the segment
    Send ^a
    Send ^c
    Send !{Delete}
    Send {Up}
    Send {Down}
    Send ^v
    Sleep 100
    Send !q ; (alt+Q is my custom shortcut to confirm the segment)
    Return

    I like your idea of overwriting target with source instead of having to move the cursor up and down to clear the AT status, so I'll modify my script with that.

  • For some reason I can't get "copy source to target" to work reliably with this script, so I reverted to "clear segment" but got rid of the up and down arrows to move out of the segment and back into it (I can't remember now why I had added that, but if it comes back to me I'll report back).

    Here's another variation of the script that combines inserting the translation result (when AT is not populated automatically into the segment) and removing the AT status. This script doesn't confirm the segment, so it will just insert the translation result, remove the AT status and leave it ready for post-editing.

    This script passes through the usual function of Ctrl+1, and it just adds the extra functionality to the shortcut.

    ~^1:: ;Inserts translation result and removes AT status
    Send ^a
    Send ^c
    Send !{Delete}
    Send ^v
    Return

    The script can be modified to do the same for Ctrl+2, Ctrl+3, etc.
  • Hi Paul,

    Is it possible to clear the AT statuses for all strings in one go? Or can we change a convenient shorcut key instead of ctrl+shift+f? Thanks.


    Regards,
    Ivan
  • Hello Ivan,

    Of course you can change the shortcut key. The relevant part is this:

    ^+f

    ^ = Ctrl
    + = Shift
    f = f

    You can find a list of all the hotkey commands here:

    autohotkey.com/.../Hotkeys.htm

    On changing them all... anything is possible I guess. Sounds as though you've got some reading to do ;-)

    autohotkey.com/.../Tutorial.htm

    Regards

    Paul
  • Pengfei Niu said:
    Hi Paul,

    Is it possible to clear the AT statuses for all strings in one go? Or can we change a convenient shorcut key instead of ctrl+shift+f? Thanks.


    Regards,
    Ivan
     

    Hi Ivan,

    To remove all AT statuses in one go, I would suggest using the SDLXLIFF Anonymizer app, a couple of clicks and you're done. Here's the link: http://appstore.sdl.com/app/sdlxliff-anonymizer/580/.

  • Thanks Paul. I will definitely read the tutorials.
  • Hi Nora,

    That's cool. I just tried. It works. Many thanks.

    Ivan
  • I also have a script that I use when Pretranslation doesn’t fill up all the segments...
    Basically, all you have to do is filter all the empty segments first (Review > Not translated) and run this script.
    It will automatically apply the translation from the TM/MT, while keeping the match status (for fuzzies, 100% and CM matches) and removing the AT status, by checking the color of the box showing up in the translation results. Therefore, you have to adjust the coordinates of this box in the script, depending on your own setup...
    I also use a 30 seconds timer to make sure the script doesn’t remain stuck in case no translation is found... And it will hit Enter, as it also happens that an error message shows up from time to time, so it will clear the message in order to resume the process.

    I also have an extra couple of lines (that I removed here) that will stop the script once the last row is reached, but this needs some adjustment.


    #IfWinNotActive ahk_class ConsoleWindowClass

    ;press on Win+F2 to run the macro
    #F2::

    Loop, 500000
    {
    if (BoolTimer=0) ; timer stopped
    {
    SetTimer, Alert1, 30000 ; activate 30 seconds timer - not to be stuck in one segment if no results shows up
    BoolTimer=1 ; timer boolean activated
    }

    WinActivate, SDL Trados Studio ; activate Studio
    PixelGetColor, color, 734, 252 ; Check the color of this point in the ACTIVE WINDOW. You have to update the coordinates depending on your setup. I make sure to spot the top left corner of the "color box" showing the fuzzy/100%/CM/AT match showing on the left of the translation, in the Translation Results window.
    if (color="0xBA7E00") ; Case of AT
    {
    WinActivate, SDL Trados Studio ; activate Studio
    Send !{Del} ; delete target segment (Alt+Del)
    clipboard = ; empty clipboard
    Send,^t ; insert TM translation (Ctr+T)
    Send {enter} ; press Enter (in case of an error message, not to remain stuck; won’t do any harm otherwise)
    Send,^a ; select all segment (Ctrl+A)
    Send,^a ; select all segment (Ctrl+A) - don’t ask why, sometimes it bugs if this is not here twice
    Send,^c ; copy target segment (Ctrl+C)
    Send !{Del} ; delete target segment (Alt+Del)
    Send,^v ; paste clipboard in target segment (Ctrl+V)
    clipboard = ; empty clipboard.
    Send,^{Down} ; goes to next segment (Ctrl+down arrow)
    SetTimer, Alert1, off ; stop timer
    BoolTimer=0 ; timer boolean stopped
    }
    else
    {
    if (color="0x00A211") ; case of 100%/CM match
    {
    WinActivate, SDL Trados Studio ; activate Studio
    clipboard = ; empty clipboard.
    Send {enter} ; press Enter (in case of an error message, not to remain stuck; won’t do any harm otherwise)
    Send,^{Down} ; goes to next segment (Ctrl+down arrow)
    SetTimer, Alert1, off ; stop timer
    BoolTimer=0 ; timer boolean stopped
    }
    else
    {
    if (color!="0xFFFFFF") ; case of fuzzy translation
    {
    WinActivate, SDL Trados Studio ; activate Studio
    Send !{Del} ; delete target segment
    clipboard = ; empty clipboard.
    Send,^t ; insert TM translation (Ctr+T)
    clipboard = ; empty clipboard.
    Send {enter} ; press Enter (in case of an error message, not to remain stuck; won’t do any harm otherwise)
    Send,^{Up} ; goes to next segment (Ctrl+down arrow)
    SetTimer, Alert1, off ; stop timer
    BoolTimer=0 ; timer boolean stopped
    }
    else ; case of no translation showing up
    {
    Send {enter} ; press Enter (in case of an error message, not to remain stuck; won’t do any harm otherwise)
    ;THIS LAST PART DOESN’T ALWAYS WORK, so I just put it in comments
    ;Send,^{Down} ; goes to next segment (Ctrl+down arrow)
    SetTimer, Alert1, off ; stop timer
    BoolTimer=0 ; timer boolean stopped
    }
    }
    }
    }

    Alert1: ; Timer is expired, no translation has been found in the TM/MT
    SetTimer, Alert1, off ; stop timer
    BoolTimer=0 ; timer boolean stopped
    WinActivate, SDL Trados Studio ; activate Studio
    Send {enter} ; press Enter (in case of an error message, not to remain stuck; won’t do any harm otherwise)
    Send !{Del} ; delete target segment
    Send,^s ; save
    Send,^{Down} ; goes to next segment (Ctrl+down arrow)

    #IfWinNotActive
  • Quoting:

    ~^1:: ;Inserts translation result and removes AT status
    Send ^a
    Send ^c
    Send !{Delete}
    Send ^v
    Return

     

    Hm, this changes the status from unedited to edited AT for me but does not remove AT. This is how I normally manually remove AT scores (delete = empty target segment). Does your 1 assume the top row numbers or number pad? I already have customized ctrl + number pad (x) as a shortcut for entering translation results. As for moving out and back into the target: Studio sometimes has an issue with keeping focus in the cleared target segment, in which case you have to manually do that. Maybe that's why you added it?

  • This does not work for me as I was expecting and it is the same as with Nora's script: it changes unedited status to edited but does not clear the AT status to new translation for me. Any idea why?
  • Hi ,

    Maybe you need a delay in there. Or maybe you have different shortcuts than the ones I use. What happens if you do this?

    1. Click in a target segment with the AT status
    2. Press Ctrl+A (to select all the text)
    3. Press Ctrl+C (to copy the selected text to the clipboard)
    4. Press Alt+Ins (to copy source to target)
    5. Press Ctrl+A (to select all the text)
    6. Press Ctrl+V (to paste the original content back in)

    Does that all work with these shortcuts? If it doesn't then replace the appropriate part of the script with the shortcuts you use.

    Regards

    Paul
  • No idea, but try this manually: select content of segment (Ctrl+A, copy (Ctrl+C), delete segment (Alt+Del) - this clears everything, including the AT status, paste (Ctrl+V). If you get the original content, without the AT status, my script should do the same. Otherwise, you may want to check your shortcuts in Studio options? Maybe your shortcut to clear a segment is something else, in which case you can either change it to Alt+Del or update the script to your own shortcut
  • I don’t think it needs a delay in here (never experienced issues with the speed), but probably a shortcut issue indeed... We are on the same line!
  • Hi Paul,

    I suspected that it was in my custom shortcuts but I reverted "alt + ins" instead of "alt + del" to test it and that did not help.
    (I always use "clear target" for this manual sequence rather than inserting source, but you added ctrl+A after that, which I don't).
    After reverting to defaults, your script now works.

    For deleting (or clearing) target segment (alt + del), I have:
    ctrl + alt + ; (=ctrl+alt+Oem1)
    And for copy source to target (alt + ins):
    ctrl + alt + ' (=ctrl+alt+Oem7)
    If I want to keep these custom shortcuts, how do I change your script? I am new to AHK and haven't looked into the scripts.

    Thanks.
    Lianne