I found a caveat to solve this issue is to add "minimize" function before doing the WinHide and in this way the function is working as it should.
Anyone could help me about this if its a bug or something I'm doing wrong in Autohotkey 1.1.14.04?
Code: Select all
;--TOTALCOMMANDER
^!s::
F_HIDE_SHOW("TTOTAL_CMD","E:\D\totalcmd\TOTALCMD64.EXE")
return
F_HIDE_SHOW(PRG,PATH)
{
If WinExist("ahk_class " . PRG)
{
{
If WinActive("ahk_class " . PRG)
{
WinGetTitle, TheWinTitle, ahk_class %PRG%
menu, tray, Tip, %TheWinTitle%
menu, tray, add, %PRG%
WinMinimize; ///////////////// I add this function for solving the issue with WinActive/WinHide
WinHide, ahk_class %PRG%
return
}
else
{
WinGet, WinStat, MinMax, ahk_class %PRG%
If (WinStat = -1)
{
WinRestore, ahk_class %PRG%
WinActivate, ahk_class %PRG%
}
else
{
menu, tray, UseErrorLevel
menu, tray, Delete, %PRG%
WinShow, ahk_class %PRG%
WinActivate, ahk_class %PRG%
}
}
}
}
else
{
Run %PATH%
WinActivate, ahk_class %PRG%
}
}