Sean wrote:
pajenn wrote:
Is there any way to modify the WinTraymin function so preserve the tray icon?
Ensure that the auto-execution section of the script is actually executed, specifically in this case
DetectHiddenWindows On and
hAHK.
That worked. Thanks.
In particular, I added the two lines to my code for launching FreeSpell:
Code:
#f3::
Run %A_ProgramFiles%\FreeSpell\FreeSpell.exe
WinWait, FreeSpell 4.5 ahk_class #32770
freeID:= WinExist("FreeSpell 4.5 ahk_class #32770")
DetectHiddenWindows On
hAHK:=WinExist("ahk_class AutoHotkey ahk_pid " . DllCall("GetCurrentProcessId"))
WinTraymin(freeID,0)
ToggleFree:=1
Return
fwiw, I changed the FreeSpell launcher script to just minimize the program to tray if already running, but not minimized, and vice versa:
Code:
#f3::
Process, Exist, FreeSpell.exe
If ErrorLevel
{
DetectHiddenWindows, Off
If !WinExist("FreeSpell 4.5 ahk_class #32770")
{
WinTraymin(freeID,-1)
WinRestore, FreeSpell 4.5 ahk_class #32770
}
Else
WinTraymin(freeID,0)
}
Else
{
Run %A_ProgramFiles%\FreeSpell\FreeSpell.exe
WinWait, FreeSpell 4.5 ahk_class #32770
freeID:= WinExist("FreeSpell 4.5 ahk_class #32770")
DetectHiddenWindows, On
hAHK:=WinExist("ahk_class AutoHotkey ahk_pid " . DllCall("GetCurrentProcessId"))
WinTraymin(freeID,0)
}
Return