I put the code together so that I can get the desired result. The problem is that each of the parts run without problems, the first and the second parts run without problems, but when I add the third part of the code, only the third part runs.
Code: Select all
; Part 1
#Persistent
SetTimer, Alert1, 500
return
Alert1:
IfWinNotExist, Start menu ahk_class DV2ControlHost
return
SetTimer, Alert1, Off
Sleep, 1000
; Part 2
#persistent
SetTimer, MouseCheck, 100
MouseCheck:
MouseGetPos, MouseX, MouseY
If MouseX between 270 and 335
If MouseY between 553 and 570
; Part 3
Lbutton::
while (GetKeyState("Lbutton", "P")) {
MsgBox You Pressed Left Button!
}
return