Enhanced Replace operation to go back to originally active segment

This script will take the user back to the segment where the Replace operation was initiated, instead of to the last segment where the Replace operation was executed, which is Studio's default behavior.

The script works by inserting some placeholder text ("markerhere") in the original segment to be found and deleted at the end of the Replace operation.

Hotkeys to run the script:

Ctrl+H - Adds "markerhere" to the active segment. Opens the Replace window. If some text is selected, it will be pasted into the "Find what" field in the Find and Replace dialog box.

Enter - Runs the "Replace all" operation, no need to click Find Next and then Replace All.

Esc - Finds and deletes the "markerhere" placeholder text, leaving the user at the originally active segment, and closes the Find and Replace dialog box.

 

#IfWinActive ahk_exe SDLTradosStudio.exe
$^h::
Send ^c
Sleep 200
Send ^a{right}
Sleep 200
Send {Space}markerhere
Sleep 100
Send ^{PgUp}
KeyWait, h
send ^h
Sleep 200
Send ^v
Sleep 100
Send {tab}
return


#IfWinActive, Find and Replace, &Find what:
Enter::
Controlclick, Find &Next, Find and Replace
Sleep 1000
Controlclick, R&eplace All, Find and Replace
Return

Esc::
WinActivate, Find and Replace
Sendinput {Space}markerhere
Sleep 200
Sendinput {tab}
Sleep 200
Sendinput {delete}
Sleep 200
Controlclick, Find &Next, Find and Replace
Sleep 1000
Controlclick, R&eplace All, Find and Replace
Sleep 500
Controlclick, &Close, Find and Replace
Sleep 200
Return
#IfWinActive

 

Parents
  • Isn’t it possible to set a temporary bookmark, instead of changing the target text?

  • Well, using bookmarks would require far more steps and preparation.

    First, you'd have to assign shortcuts to "add bookmark", "remove bookmark", "view bookmarks" and "go to bookmark".

    Second, you can't go to a bookmark using just the keyboard.  To go to a bookmark, you have to open the bookmarks view panel, select the bookmark using the mouse, and then use the "go to bookmark" function.  And then you have to remove the bookmark (otherwise you end up with dozens of useless bookmarks), for which you have to use the mouse and the bookmarks view panel all over again.

    I think the "bookmarks" feature in Trados was designed for people who want to frequently move to specific points in a long project.  They are by design non-temporary.

Reply
  • Well, using bookmarks would require far more steps and preparation.

    First, you'd have to assign shortcuts to "add bookmark", "remove bookmark", "view bookmarks" and "go to bookmark".

    Second, you can't go to a bookmark using just the keyboard.  To go to a bookmark, you have to open the bookmarks view panel, select the bookmark using the mouse, and then use the "go to bookmark" function.  And then you have to remove the bookmark (otherwise you end up with dozens of useless bookmarks), for which you have to use the mouse and the bookmarks view panel all over again.

    I think the "bookmarks" feature in Trados was designed for people who want to frequently move to specific points in a long project.  They are by design non-temporary.

Children
No Data