Thanks for reading.
I'm having a hard time coding for variable boundaries.
What I'm trying to do is to get a hotkey to reset it's Toggle if the mouse cursor is around the center of the screen.
Here's the relevant code I tried:
Code: Select all
#SingleInstance, force
CoordMode, Mouse
LowY:= A_ScreenHeight / 3
HighY:= A_ScreenHeight * 2/3
LowX:= A_ScreenWidth / 3
HighX:= A_ScreenWidth * 2 / 3
XButton1 & 1::
MouseGetPos, PosX, PosY
If (PosY between A_ScreenHeight / 3 and A_ScreenHeight * 2/3) {
If (PosX between A_ScreenWidth / 3 and A_ScreenWidth * 2 / 3)
Msgbox Inbound, X%posX% Y%PosY%
}
Return
XButton1 & 2::
MouseGetPos, PosX, PosY
If (PosY between LowY and HighY) {
If (PosX between LowX and HighX)
Msgbox Inbound, X%posX% Y%PosY%
}
Return
XButton1 & 3::
MouseGetPos, PosX, PosY
If PosY between LowY and HighY
If PosX between LowX and HighX
Msgbox Inbound, X%posX% Y%PosY%
Return
XButton1 & 4::
MouseGetPos, PosX, PosY
If PosY !< LowY
if PosY !> HighY
If PosX !< LowX
if PosX !> HighX
Msgbox Inbound, X%posX% Y%PosY%
Return
Thanks in advance and kind regards!