Code: Select all
Hotkey, If, % L(1, 2, 3, 4)
Hotkey, ^1, test
L(pX1, pY1, pX2, pY2)
{
MouseGetPos, LX, LY
Return (pX1<=LX) && (LX<=pX2) && (pY1<=LY) && (LY<=pY2)
}
Code: Select all
Hotkey, If, % L(1, 2, 3, 4)
Hotkey, ^1, test
L(pX1, pY1, pX2, pY2)
{
MouseGetPos, LX, LY
Return (pX1<=LX) && (LX<=pX2) && (pY1<=LY) && (LY<=pY2)
}
Expression must be an expression which has been used with the #If directive elsewhere in the script. Although this command is unable to create new expressions, it can create new hotkeys using an existing expression.
just edited the original post, it's the mouse positionmikeyww wrote: ↑17 Aug 2022, 19:58Is LX a variable name? What is its value when you display it?
See https://www.autohotkey.com/docs/commands/Hotkey.htm#ExampleIfFn
Expression must be an expression which has been used with the #If directive elsewhere in the script. Although this command is unable to create new expressions, it can create new hotkeys using an existing expression.
Code: Select all
#SingleInstance Force
fn := Func("L").Bind(1, 2, 3, 4)
Hotkey, If, % fn
Hotkey, ^1, Test
Hotkey, If
Return
Test:
MsgBox, Test
Return
L(pX1, pY1, pX2, pY2) {
MsgBox, %pY1%
; Return False
Return True
}