我正在制作一个自动热键脚本来切换到文本编辑器,但根据我正在处理的内容,我可能有不同的文本编辑器。
我用三个文本编辑器创建了一个文本编辑器组:
GroupAdd, TextEditor, ahk_class Notepad++
GroupAdd, TextEditor, ahk_exe Code.exe
GroupAdd, TextEditor, ahk_class Notepad
该组似乎已正确创建,但每当我使用
GroupActivate, TextEditor, R
时,它总是会打开 Nodepad++ 并重复按下在三个编辑器之间切换。
我希望它首先打开我上次使用的任何内容,就像我正在使用 Code 并切换到另一个程序一样,它应该再次激活 Code。
GroupAdd, TextEditor, ahk_class Notepad++
GroupAdd, TextEditor, ahk_exe Code.exe
GroupAdd, TextEditor, ahk_class Notepad
F1::
IfWinActive ahk_group TextEditor
GroupActivate, TextEditor, R
else
{
list := ""
; windows are retrieved in order from the most recent to the last activated:
WinGet, myWindows, List, ahk_group TextEditor
WinActivate, ahk_id %myWindows1% ; activate the most recently active window in this group
}
return