如何在 Autohotkey 中自動反白指定文字?

如何在 Autohotkey 中自動反白指定文字?

例如,這會將所有單字 test 替換為 test。

:*?:test::test2

這是有效的,但我希望它突出顯示“test2”給定的單字。

答案1

試試這樣:

 #NoEnv
 #SingleInstance Force

 ; Create a group of the windows you want to execute this or more hotstrings in the auto-execute section (top of the script):

; ahk_group Editors_Group
GroupAdd, Editors_Group, ahk_class Notepad
GroupAdd, Editors_Group, ahk_class Notepad2
GroupAdd, Editors_Group, ahk_class Notepad++
GroupAdd, Editors_Group, ahk_class WordPadClass
; ...

            RETURN   ; === end of auto-execute section ===

; and use the #IfWinActive directive to make the hotstrings context-sensitive:

#IfWinActive, ahk_group Editors_Group

    :*?:test::
        Send {Text} test2
        Send {Blind}{Text}testing
        SendInput, ^+{Left}{Left}^+{Right}
    return

    
    ;  ...

#IfWinActive  ; turn off context sensitivity

群組新增,#IfWinActive傳送在文檔中。

相關內容