Sign in to follow this  
Followers 0
AzKay

MouseMove?

14 posts in this topic

Is there a function, like MouseMove() Except, one that, moves, for example, instead of X & Y You just tell it how far to move, either left or right, so, If I press the "left arrow" key on the keyboard [ _IsPressed ] It would move the mouse, just a littlebit, if Im holding the arrow button, it doesnt stop moving left, you get what I mean?


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites



Is there a function, like MouseMove() Except, one that, moves, for example, instead of X & Y You just tell it how far to move, either left or right, so, If I press the "left arrow" key on the keyboard [ _IsPressed ] It would move the mouse, just a littlebit, if Im holding the arrow button, it doesnt stop moving left, you get what I mean?

Use MouseGetPos() to retrieve the current position of the mouse cursor and then just add a few pixels to the x or y coordinate and set that new value with MouseMove().

$pos = MouseGetPos()
$x = $pos[0]
$y = $pos[1]
MouseMove($x + 10,$y)

BTW: Use HotKeySet() to trap the "left arrow" key and set the new mouse position within the "hotkey function".

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Ah, thanks


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Hmm, I need it to be "constant" when im holding it down, but it moves/pauses/moves/pauses Any way to make it keep moving until I let go?


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#5 ·  Posted (edited)

Hmm, I need it to be "constant" when im holding it down, but it moves/pauses/moves/pauses Any way to make it keep moving until I let go?

I just tryed it with _IsPressed, to see if it would make a difference, but, It doesnt do anything, atall. For some reason, the last couple of times ive tryed using IsPressed, nothings been happening.

Nevermind, found out why, Ive been using 0x27 instead of "27"

Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Hmm, the response time isnt too good xP


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Hmm, the response time isnt too good xP

Try this:

#include <Misc.au3>

AdlibEnable("MoveTheMouse", 50)
HotKeySet("{ESC}", "TheEnd")

Global $left_arrow_pressed
Global $mouse_step_x = 3 ; pixels per move !!

;;;; Body of program would go here;;;;
While 1
    Sleep(50)
    If _IsPressed("25") Then
        $left_arrow_pressed = 1
    Else
        $left_arrow_pressed = 0
    EndIf
WEnd
;;;;;;;;

Func MoveTheMouse()
    If $left_arrow_pressed = 1 Then
        $pos = MouseGetPos()
        $x = $pos[0]
        $y = $pos[1]
        MouseMove($x - $mouse_step_x, $y, 0)
    EndIf
EndFunc  ;==>MoveTheMouse


Func TheEnd()
    Exit
EndFunc  ;==>TheEnd

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Does basically, the same as mine:

#include <Misc.au3>

While 1
If _IsPressed("27") Then
    $posRight = MouseGetPos()
    $xRight = $posRight[0]
    $yRight = $posRight[1]
    MouseMove($xRight + 150,$yRight)
EndIf

If _IsPressed("25") Then
    $posLeft = MouseGetPos()
    $xLeft = $posLeft[0]
    $yLeft = $posLeft[1]
    MouseMove($xLeft - 150,$yLeft)
EndIf
WEnd

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#9 ·  Posted (edited)

Does basically, the same as mine:

Nope! Did you try it? It moves the mouse ways more smoothly than yours.

EDIT: you can adjust the behaviour by changing $mouse_step_x and the speed of MouseMove().

Cheers

Kurt

Edited by /dev/null

__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Then, Ill try adjust it, Because, for me, it went, worse then mine, if I pressed it really quick, it kinda, spassed out other 2 pixels xD


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

#11 ·  Posted (edited)

Then, Ill try adjust it, Because, for me, it went, worse then mine, if I pressed it really quick, it kinda, spassed out other 2 pixels xD

Wait, I think it was running at the same time as the other one ^^;

EDIT::

Hmm, I added in a "right" move too, but now, only right works, left doesnt..

#include <Misc.au3>

AdlibEnable("_Left", 50)
AdlibEnable("_Right", 50)
HotKeySet("{ESC}", "TheEnd")

Global $left_arrow_pressed
Global $right_arrow_pressed
Global $mouse_step_x = 100 ; pixels per move !!

;;;; Body of program would go here;;;;
While 1
    Sleep(50)
    If _IsPressed("25") Then
        $left_arrow_pressed = 1
    Else
        $left_arrow_pressed = 0
    EndIf
    
    If _IsPressed("27") Then
        $right_arrow_pressed = 1
    Else
        $right_arrow_pressed = 0
    EndIf
WEnd
;;;;;;;;

Func _Left()
    If $left_arrow_pressed = 1 Then
        $posLeft = MouseGetPos()
        $xLeft = $posLeft[0]
        $yLeft = $posLeft[1]
        MouseMove($xLeft - $mouse_step_x, $yLeft, 0)
    EndIf
EndFunc  ;==>MoveTheMouse

Func _Right()
    If $right_arrow_pressed = 1 Then
        $posRight = MouseGetPos()
        $xRight = $posRight[0]
        $yRight = $posRight[1]
        MouseMove($xRight + $mouse_step_x, $yRight, 0)
    EndIf
EndFunc  ;==>MoveTheMouse

Func TheEnd()
    Exit
EndFunc  ;==>TheEnd
Edited by AzKay

# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Wait, I think it was running at the same time as the other one ^^;

EDIT::

Hmm, I added in a "right" move too, but now, only right works, left doesnt..

AdlibEnable can only run one function. Do this:

AdlibEnable("_MoveMouse", 50)
Func _MoveMouse()
    _Left()
    _Right()
EndFunc

Cheers

Kurt


__________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf *

Share this post


Link to post
Share on other sites

Thanks


# MY LOVE FOR YOU... IS LIKE A TRUCK- #

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0