I would like to create a script that detects side to side (x) mouse movement and will press a corresponding key.
i.e. start to move mouse left, keypress and hold key "A". Mouse stops or moves right, key release "A". Start to move mouse right, keypress and hold key "B". Mouse stops or moves left, key release "B".
Could this be done? Any ideas how to do it?
keypress linked to mouse movement
-
- Posts: 2
- Joined: 11 Jun 2019, 16:15
Re: keypress linked to mouse movement
Hallo,
try:
try:
Code: Select all
F6:: ;On/Off with key F6
IF Toggle := !Toggle
{
MouseGetPos, XOld
SetTimer, MouseTimer, 100
}
Else
SetTimer, MouseTimer, Off
Return
MouseTimer:
MouseGetPos, X
Key =
IF (X < XOld)
Key = a
Else If (X > XOld)
Key = b
XOld := X
If (Key = KeyOld)
Return
IF KeyOld
Send, {%KeyOld% Up}
IF KeyOld := Key
Send, {%Key% Down}
Return
-
- Posts: 2
- Joined: 11 Jun 2019, 16:15
Re: keypress linked to mouse movement
Thanks! That's way better than my pitiful attempt.
Who is online
Users browsing this forum: boiler, duncan21, Google [Bot], thephoenix and 226 guests