Simply put when the specified window is running I want specific hotkeys to become available. Pressing these hotkeys when the specified window is not active does nothing.
I tried using the Hotkey command but I get a "Target label does not exist" error.
#Persistent ;Keep script running until stopped
WinProc= ;Window process name
;--------------------------------
; Hooks and stuff, I have no idea what any of this does
;--------------------------------
Gui +LastFound
hWnd:=WinExist()
DllCall("RegisterShellHookWindow", UInt,hWnd)
MsgNum:=DllCall("RegisterWindowMessage", Str,"SHELLHOOK")
OnMessage(MsgNum, "ShellMessage")
return
;--------------------------------
; Wait for a window to be activated
;--------------------------------
ShellMessage(wParam,lParam)
{
if (wParam != 4) ;Check if the window is activated
return
WinGet, WinProc, ProcessName, A
;Check for Blender process
if (WinProc="blender.exe")
{
Step1Key=F4
Hotkey, %Step1Key%, gStep1Sub
Step1Sub:
MsgBox, Running Step1 subroutine
}
}




