;test by opening notepad and selecting print ^j:: SetFormat Integer, h WinGet, mwh, ID,Untitled - Notepad CMD:=6 opwh := DLLCall("user32\GetWindow", uint, mwh, int, CMD ,uint) WinGetTitle, opwt, ahk_id %opwh% ;window title of found window should say the same as the print window MsgBox % opwh " " opwt return