Problem is that every time I wake my PC from sleep I have the magnifier already launched. I'm guessing AHK just automatically triggers itself and sends the keystrokes.
I noticed the problem usually happens when I leave my PC to sleep for more than 4 hours. If I just set it to sleep then wake up right away, there is no magnifier. Also I don't have this problem if I disable the hotkey in my script.
My Windows and Autohotkey are both 64-bit.
Would really appreciate any suggestions on how to work around this
Code: Select all
SendMode Input
SetWorkingDir %A_ScriptDir%
DetectHiddenWindows, on
^!+M::StartClose("magnify.exe") ;Ctrl+Shift+Alt+M
StartClose(exe)
{
Process, Exist, %exe% ; check to see if program is running
If (ErrorLevel = 0) ; If program is not running -> Run
{
Run, %exe%
}
Else ; If program is running, ErrorLevel = process id for the target program -> Close
{
Process, Close, %ErrorLevel%
}
}