Find&Replace window on top again

Hello, possibly to @PaulFilkin, who helped me on this issue a few months ago,
I'm in trouble again with the F&R window that remains stuck on top of any page in my PC. Could be after the last Trados update?

I tried to repeat the AutoHotkey actions that were recommended to me, but to no avail. In addition to that, my antivirus is telling me that the script has a virus.

Can someone help?

Thanks in advance

emoji
Parents Reply Children
  • Hi Jesus, I doubt that having Trados' Find & Replace window on top of Google or any other program that is not Trados could be considered a "desired behavior" by any translator. What would the purpose be? If I want to exit the Trados view for any reason, I will not need to have the Trados F&R window as top view in the other pages (any Google tab, Word, Acrobat...), am I wrong?
    Anyway, I re-copied and re-pasted the last script Paul Filkin gave me months ago, which mostly (but not 100% of times) solved the problem, but the egocentric F&R window is always there!

    emoji
  • Now the problem also is that I removed the old scripts in the attempt at enabling the new one and now I've lost everything. 

    Consider that I do not understand anything of these things and that handling AutoHotkey for me is like trying to understand a text written in Arabic or Russian... Is there any difference between AutoHotkey and AutoHotkey Dash? Because I do not see the H icon in the right side

    Anyway, one script was this:

    ;------------------------------------------------------------------------------
    ; Ensure "Find and Replace" window is always on top when Trados Studio is active
    ; and not always on top when Trados Studio is not active
    ;------------------------------------------------------------------------------

    #Requires AutoHotkey v2.0

    ; Initialize the global variable
    global isOnTop := false

    #HotIf WinActive("ahk_exe SDLTradosStudio.exe")

    $^f:: triggerFindOrReplace("Find")
    $^h:: triggerFindOrReplace("Replace")

    triggerFindOrReplace(action) {
        global isOnTop
        find := "Find and Replace" ; Window title of the Find and Replace window

        if (action = "Find") {
            Send '^f'
        } else if (action = "Replace") {
            Send '^h'
        }

        If WinWaitActive(find, "", 2) {
            if !isOnTop {
                WinSetAlwaysOnTop(1, find) ; Set Always-on-Top only once
                isOnTop := true
            }
        }
    }

    ; Check the active window every 100 milliseconds
    SetTimer(CheckActiveWindow, 100)

    CheckActiveWindow() {
        global isOnTop
        find := "Find and Replace"
        activeWin := WinExist("A")

        ; Add a small delay to ensure the active window is fully registered
        Sleep(100)
        if WinActive("A") != activeWin {
            return  ; The active window has changed, do nothing
        }

        if activeWin and WinActive("ahk_exe SDLTradosStudio.exe") {
            if WinExist(find) and !isOnTop {
                WinSetAlwaysOnTop(1, find)
                isOnTop := true
            }
        } else {
            if WinExist(find) and isOnTop {
                WinSetAlwaysOnTop(0, find)
                isOnTop := false
            }
        }
    }

    #HotIf

    emoji