How to use AHK to activate Windows10 Calculator app that is in AlwaysOnTop mode
If you click on 'Keep on top' when Calculator is in Standard mode it becomes something like this
Note that it has no title bar
The AHK script I use to activate an already open Calculator is no longer working
#c::
if not WinExist("Calculator")
{
Run calc.exe
WinWait Calculator
}
WinActivate Calculator
I tried tips from How to get window handle by PID in autohotkey?
But I am not getting a valid class id, this is my script with some debugging added:
#c::
DetectHiddenWindows, on
Process, Exist, Calculator.exe
cpid := ErrorLevel
WinGetClass, ClassID, ahk_pid %cpid%
WinGetTitle, Title, ahk_pid %cpid%
exist := WinExist("ahk_exe Calculator.exe")
active := WinActive("ahk_exe Calculator.exe")
MsgBox look for [%cpid%] [%Title%] [%ClassID%] [%exist%] [%active%] ; cpid is the only valid variable
if not WinExist("Calculator")
{
Run calc.exe
WinWait Calculator
}
WinActivate Calculator