DonationCoder.com Software > Finished Programs
SOLVED: autohotkey makes cursor slide - i want mouse movement to halt the slide
nudone:
okay, this is working fine (almost). i just had to change the if statement to use % % and it started working.
i've been trying to add a bit of a buffer, or error margin, so that the loop doesn't break instantly when it detects mouse movement - i'm sure it will feel better if the cursor is allowed to move slightly off course as it slides.
but, my logic and autohotkey knowledge aren't up to the task (i've not included my OR statements here as they are obviously just completely wrong).
could anyone (Target) see how to add a mouse movement buffer or margin to the script below?
--- Code: AutoIt ---Hotkey, #k, MoveUpHotkey, ^!+k, MoveUp ; * to work with programmable mouse buttons (if winkey not accepted)Hotkey, ^!+j, MoveDownHotkey, #j, MoveDown ; *Hotkey, #+j, MoveLeftHotkey, ^!+h, MoveLeft ; *Hotkey, #+k, MoveRightHotkey, ^!+l, MoveRight ; * horizontalspeed=0 ; 0 = fastest, 100 = slowestverticalspeed=0speedmultiplier=30 ; cursor movement needs speeding up a bitrightscreenwidth=1920 ; width of monitorscreenheight=1200 ; height of monitorreturn MoveUp:MouseGetPos, xpos, yposloop{ MouseGetPos, xpos_, if xpos_ <> %xpos% Break ypos -= speedmultiplier MouseMove, xpos, ypos, verticalspeed if ypos = 0 Break}return MoveDown:MouseGetPos, xpos, yposloop{ MouseGetPos, xpos_, if xpos_ <> %xpos% Break ypos += speedmultiplier MouseMove, xpos, ypos, verticalspeed if ypos = %screenheight% Break}return MoveLeft:MouseGetPos, xpos, yposloop{ MouseGetPos, , ypos_ if ypos_ <> %ypos% Break xpos -= speedmultiplier MouseMove, xpos, ypos, horizontalspeed if xpos = 0 Break}return MoveRight:MouseGetPos, xpos, yposloop{ MouseGetPos, , ypos_ if ypos_ <> %ypos% Break xpos += speedmultiplier MouseMove, xpos, ypos, horizontalspeed if xpos = %rightscreenwidth% Break}return
skwire:
Adjust the FudgeFactor variable to your liking:
--- Code: AutoIt ---Hotkey, #k, MoveUpHotkey, ^!+k, MoveUp ; * to work with programmable mouse buttons (if winkey not accepted)Hotkey, ^!+j, MoveDownHotkey, #j, MoveDown ; *Hotkey, #+j, MoveLeftHotkey, ^!+h, MoveLeft ; *Hotkey, #+k, MoveRightHotkey, ^!+l, MoveRight ; * horizontalspeed=0 ; 0 = fastest, 100 = slowestverticalspeed=0speedmultiplier=30 ; cursor movement needs speeding up a bitrightscreenwidth=1920 ; width of monitorscreenheight=1200 ; height of monitorFudgeFactor=50return MoveUp:MouseGetPos, xpos, yposloop{ MouseGetPos, xpos_, If ( xpos_ < ( xpos - FudgeFactor ) OR ( xpos_ > ( xpos + FudgeFactor ) ) ) Break ypos -= speedmultiplier MouseMove, xpos, ypos, verticalspeed if ypos = 0 Break}return MoveDown:MouseGetPos, xpos, yposloop{ MouseGetPos, xpos_, If ( xpos_ < ( xpos - FudgeFactor ) OR ( xpos_ > ( xpos + FudgeFactor ) ) ) Break ypos += speedmultiplier MouseMove, xpos, ypos, verticalspeed if ypos = %screenheight% Break}return MoveLeft:MouseGetPos, xpos, yposloop{ MouseGetPos, , ypos_ If ( ypos_ < ( ypos - FudgeFactor ) OR ( ypos_ > ( ypos + FudgeFactor ) ) ) Break xpos -= speedmultiplier MouseMove, xpos, ypos, horizontalspeed if xpos = 0 Break}return MoveRight:MouseGetPos, xpos, yposloop{ MouseGetPos, , ypos_ If ( ypos_ < ( ypos - FudgeFactor ) OR ( ypos_ > ( ypos + FudgeFactor ) ) ) Break xpos += speedmultiplier MouseMove, xpos, ypos, horizontalspeed if xpos = %rightscreenwidth% Break}return
nudone:
okay, that's great, skwire.
with FudgeFactor=10 and an added FudgeFactorHorizontal=2 (for horizontal cursor slides across the screen), it feels about right.
i'm happy with how things are now - but it would be a near perfect script if the cursor slide could "transition/merge" into the manual cursor movement when user moves the mouse. maybe that is expected way too much though as there could/would be times when the user wants to break the slide immediately - so a set transition would be annoying.
(p.s. i think my OR statement was missing a bracket as it looked about the same - that's reassuring that i wasn't totally out of my depth.)
Perry Mowbray:
i'm happy with how things are now - but it would be a near perfect script if the cursor slide could "transition/merge" into the manual cursor movement when user moves the mouse. maybe that is expected way too much though as there could/would be times when the user wants to break the slide immediately - so a set transition would be annoying.
-nudone (May 06, 2010, 06:10 AM)
--- End quote ---
I think you'd need to be careful that you don't end up chasing your cursor all around your monitors?
This just reminded me of an Amiga mouse hack the kids loved... a rocket was launched when the programme ran and chased the cursor; the user moved the cursor away from the rocket which then changed course and kept chasing... until it caught up with the cursor and it exploded and the cursor disappeared: just long enough for you to wonder what you were going to do without a cursor (the first time anyway).
nudone:
I think you'd need to be careful that you don't end up chasing your cursor all around your monitors?
-Perry Mowbray (May 06, 2010, 07:34 AM)
--- End quote ---
good point.
Navigation
[0] Message Index
[#] Next page
[*] Previous page
Go to full version