I found on the old forum a perfect solution (https://autohotkey.com/board/topic/74282-how-to-react-to-appearance-of-a-window/):
Code: Select all
DetectHiddenWindows, On
Hwnd := WinExist(A_ScriptFullPath)
DllCall( "RegisterShellHookWindow", UInt,Hwnd )
MsgNum := DllCall( "RegisterWindowMessage", Str,"SHELLHOOK" )
OnMessage( MsgNum, "ShellMessage" )
Return
ShellMessage( wParam,lParam )
{
WinGetClass, Class, ahk_id %lParam%
If (Class = "Notepad")
MsgBox Action goes here!
return
}
Is such a solution that uses a hook still possible?