iseahound wrote: ↑06 Sep 2022, 18:17
try making the hotkey
Adding the dollar sign didn't work in my case. Instead, changing
IfWinExist (deprecated) into function calls of
WinExist helped.
The problem: I had similar issues with the following code snippet, where a new TOTALCMD.EXE process would get started although there are existing windows/processes for that process and an existing window has been activated.
Code: Select all
; Define a group for looping through existing instances
groupadd , TC_cmd , ahk_class TTOTAL_CMD
return
; Here, with the updated $-sign, the hotkey (win + 1) still does two things: activate the existing window *AND* launch a new instance :)
$#1:: Gosub win_1_TC
win_1_TC:
IfWinExist ahk_group TC_cmd
groupactivate, TC_cmd, r
else
run "C:\Program Files\totalcmd\TOTALCMD.EXE"
return
Solution: rewrite the subroutine as the following, by calling the
WinExist function instead.
Code: Select all
win_1_TC:
if (WinExist("ahk_group TC_cmd")) {
groupactivate, TC_cmd, r
}
else {
run "C:\Program Files\totalcmd\TOTALCMD.EXE"
}
return
PS: just curious, how old is
IfWinExist and when did it get deprecated in AHK 1.X?