this code: once a button is clicked waits until next left click to execute on my mouse position
Code: Select all
if the timer is on zero i want it to escape the actions linked to that button
at the moment i have some escape options already: Esc, RButton, Insert, F12, Backspace
those work as they should
the timer does work only it does not stop the rest of the code as my Esc, RButton, Insert, etc. will do
i included a mini gui to show what is going on
it is very visual what is going on with splashtext if your interested to have a look
EQ2 is the one with the timer included on top
Code: Select all
CoordMode, Mouse, Screen
#SingleInstance, Force
Gui, Add, Button, x2 y0 w163 h67 gEQ2, Test
Gui, Show, w195 h92, Untitled GUI
return
Timer()
{
mouseGetPos,mx,my
mx+=25
my-=15
Progress, cw000000 CTFFFFFF W150 ZX1 ZY1 x%mx% y%my% m b fs25 zh0,Canseled, , , Arial
Sleep 400
Progress,Off
gosub, return
}
return:
return
GuiClose:
ExitApp
Timer:
Timer()
return
EQ2:
SetTimer, Timer, -2000
;GuiControl,5:,Butto2,Assets/1/EQ2_on.png
;While(GetKeyState("LButton"))
;Sleep,10
;GuiControl,5:,Butto2,Assets/1/EQ2_off.png
;IfWinExist, ahk_class TFXForm
;WinActivate
while(!GetKeyState("LButton", "p"))
{
CoordMode, Mouse, Screen
mouseGetPos,mx,my
mx+=25
my-=15
Progress, cw000000 CTFFFFFF W170 ZX1 ZY1 x%mx% y%my% m b fs25 zh0,Insert EQ2, , , Arial
{
if(GetKeyState("Esc", "p"))
{
Send, {F9}
mouseGetPos,mx,my
mx+=25
my-=15
Progress, cw000000 CTFFFFFF W150 ZX1 ZY1 x%mx% y%my% m b fs25 zh0,Canseled, , , Arial
Sleep 400
Progress, Off
Goto, return
}
else if(GetKeyState("RButton", "p"))
{
mouseGetPos,mx,my
mx+=25
my-=15
Progress, cw000000 CTFFFFFF W150 ZX1 ZY1 x%mx% y%my% m b fs25 zh0,Canseled, , , Arial
Sleep 400
Progress, Off
Goto, return
}
else if(GetKeyState("Insert", "p"))
{
mouseGetPos,mx,my
mx+=25
my-=15
Progress, cw000000 CTFFFFFF W150 ZX1 ZY1 x%mx% y%my% m b fs25 zh0,Canseled, , , Arial
Sleep 400
Progress, Off
Goto, return
}
else if(GetKeyState("F12", "p"))
{
mouseGetPos,mx,my
mx+=25
my-=15
Progress, cw000000 CTFFFFFF W150 ZX1 ZY1 x%mx% y%my% m b fs25 zh0,Canseled, , , Arial
Sleep 400
Progress, Off
Goto, return
}
else if(GetKeyState("Backspace", "p"))
{
mouseGetPos,mx,my
mx+=25
my-=15
Progress, cw000000 CTFFFFFF W150 ZX1 ZY1 x%mx% y%my% m b fs25 zh0,Canseled, , , Arial
Sleep 400
Progress, Off
Goto, return
}
}
}
Progress, Off
; rest of code here
MsgBox, you clicked left to execute the rest
return