Quickly*) add source and target segments as term pairs**) to a termbase


#NoEnv ; Recommended for performance and compatibility with future AutoHotkey releases.
; #Warn ; Enable warnings to assist with detecting common errors.
SendMode Input ; Recommended for new scripts due to its superior speed and reliability.
SetWorkingDir %A_ScriptDir% ; Ensures a consistent starting directory.
^q::
;Toggle to the source side and select up to the end of the line
Send, {F6}
Send, +{End}
;Toggle to the target side and select up to the end of the line
Send, {F6}
Send, +{End}
;Quickly add the selections to the default termbase
Send, ^+{F2}
Sleep, 1000
;Go to the next segment
Send, ^{Enter}
return


*) Daredevils can add a loop to the macro.
*) I guess that multi-line segments will need something like +{EndOfSegment} instead of +{End}?

Caveats:

- The macro stops at identical targets (probably at identical sources too ...).
- It doesn't handle synonyms correctly (you'll have to prepare the input manually).



Changed the Title to something more appropriate
[edited by: Hans Lenting at 9:30 AM (GMT 1) on 27 May 2022]
emoji
Parents
  • AutoHotkey macro to add the current segments (source and target) to the default termbase:

    #NoEnv
    SendMode Input
    SetWorkingDir %A_ScriptDir%
    ;Name: QuicklyAddCurrentSegmentsAsTermpairToTermbase.ahk
    ;Purpose: Use this script to quickly add the current source and target segment as a term pair to the default termbase.
    ^q::
    ;Toggle to the source side and select up to the end of the segment
    Send, {F6}
    Send, ^+{Down}
    ;Toggle to the target side and select up to the end of the segment
    Send, {F6}
    Send, ^+{Down}
    ;Quickly add the selections to the default termbase
    Send, ^+{F2}
    Sleep, 1000
    ;Go to the next segment
    Send, ^{Enter}
    return

    AutoHotkey macro to add all segments (source and target) to the default termbase:

    <img style="max-width:800px;" src="">res.cloudinary.com/.../quzhpt8jtbxkqixtiknm.png" alt="Screen Shot 2022-05-28 at 07.29.36">

    #NoEnv
    SendMode Input
    SetWorkingDir %A_ScriptDir%
    ;Name: QuicklyAddAllSegmentsAsTermpairToTermbase.ahk
    ;Purpose: Use this script to quickly add all segments as term pairs to the default termbase.
    ;All segments must be unconfirmed (Edited or Not Translated)
    ^w::
    InputBox,Var,Quickly Add Term Pairs, How many Term Pairs (segments) do you want to add to the default Termbase?
    loop, % Var
    {
    ;Toggle to the source side and select up to the end of the segment
    Send, {F6}
    Send, ^+{Down}
    ;Toggle to the target side and select up to the end of the segment
    Send, {F6}
    Send, ^+{Down}
    ;Quickly add the selections to the default termbase
    Send, ^+{F2}
    Sleep, 1000
    WinWaitActive, Selected Term Already Exists,,1
    if !ErrorLevel
    Send, {Enter}
    ;Go to the next segment; if you don't want to store translations in your TM, replace Send, ^{Enter} with Send, ^{Down}
    Send, ^{Enter}
    }
    return

    emoji
Reply
  • AutoHotkey macro to add the current segments (source and target) to the default termbase:

    #NoEnv
    SendMode Input
    SetWorkingDir %A_ScriptDir%
    ;Name: QuicklyAddCurrentSegmentsAsTermpairToTermbase.ahk
    ;Purpose: Use this script to quickly add the current source and target segment as a term pair to the default termbase.
    ^q::
    ;Toggle to the source side and select up to the end of the segment
    Send, {F6}
    Send, ^+{Down}
    ;Toggle to the target side and select up to the end of the segment
    Send, {F6}
    Send, ^+{Down}
    ;Quickly add the selections to the default termbase
    Send, ^+{F2}
    Sleep, 1000
    ;Go to the next segment
    Send, ^{Enter}
    return

    AutoHotkey macro to add all segments (source and target) to the default termbase:

    <img style="max-width:800px;" src="">res.cloudinary.com/.../quzhpt8jtbxkqixtiknm.png" alt="Screen Shot 2022-05-28 at 07.29.36">

    #NoEnv
    SendMode Input
    SetWorkingDir %A_ScriptDir%
    ;Name: QuicklyAddAllSegmentsAsTermpairToTermbase.ahk
    ;Purpose: Use this script to quickly add all segments as term pairs to the default termbase.
    ;All segments must be unconfirmed (Edited or Not Translated)
    ^w::
    InputBox,Var,Quickly Add Term Pairs, How many Term Pairs (segments) do you want to add to the default Termbase?
    loop, % Var
    {
    ;Toggle to the source side and select up to the end of the segment
    Send, {F6}
    Send, ^+{Down}
    ;Toggle to the target side and select up to the end of the segment
    Send, {F6}
    Send, ^+{Down}
    ;Quickly add the selections to the default termbase
    Send, ^+{F2}
    Sleep, 1000
    WinWaitActive, Selected Term Already Exists,,1
    if !ErrorLevel
    Send, {Enter}
    ;Go to the next segment; if you don't want to store translations in your TM, replace Send, ^{Enter} with Send, ^{Down}
    Send, ^{Enter}
    }
    return

    emoji
Children
No Data