Sign in to follow this  
Followers 0
ihenvyr

emulate mouse movements

6 posts in this topic

hello..

is it possible to emulate mouse movements

with a hotkey? B)

for example:

left arrow moves mouse cursor to left

right arrow moves mouse cursor to right

..etc

pls.. any suggestions?

thanks m8!!


Umbrella Member

Share this post


Link to post
Share on other sites



I don't know if it works with the arrows... but take a look at IsPressed()


[center]Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer.[/center]

Share this post


Link to post
Share on other sites

CTRL+SHIFT+(tilda) to exit

HotKeySet("{LEFT}","weft")
HotKeySet("{RIGHT}","wight")
HotKeySet("^+`","bye")
While 1
    Sleep(10)
WEnd

Func bye()
    Exit
EndFunc
Func weft()
    Local $pos = MouseGetPos()
    MouseMove($pos[0] - 10, $pos[1],0)
EndFunc
Func wight()
    Local $pos = MouseGetPos()
    MouseMove($pos[0] + 10, $pos[1],0)
EndFunc

Thanks Larry you're a champ!! B)

..but still confuse me bout the UP arrow and DOWN arrow?

ive already spend 1 hour working but can't catch it!!

please ..anybody HELP :o


Umbrella Member

Share this post


Link to post
Share on other sites

Simple...

HotKeySet( "w", "_UpArrow")
HotKeySet( "s", "_DownArrow")
HotKeySet( "a", "_Leftarrow")
HotKeySet( "d", "_RightArrow")
HotKeySet( "q", "_LeftClick")
HotKeySet( "e", "_RightClick")
HotKeySet( "{F10}", "_Close")
$x = 100
$y = 100
$z = -1
MouseMove($x, $y)
While 1
    If $z = 0 Then
        Exit
    EndIf
Wend
Func _UpArrow()
    $y = $y - 10
    MouseMove($x, $y, 0)
EndFunc;==>_UpArrow
Func _DownArrow()
    $y = $y + 10
    MouseMove($x, $y, 0)
EndFunc;==>_DownArrow
Func _Leftarrow()
    $x = $x - 10
    MouseMove($x, $y, 0)
EndFunc;==>_Leftarrow
Func _RightArrow()
    $x = $x + 10
    MouseMove($x, $y, 0)
EndFunc;==>_RightArrow
Func _LeftClick()
    MouseClick( "left", $x, $y, 1, 0)
EndFunc;==>_LeftClick
Func _RightClick()
    MouseClick( "right", $x, $y, 1, 0)
EndFunc;==>_RightClick
Func _Close()
    $z = 0
    Exit
EndFunc;==>_Close

W = UpMouse

S = DownMouse

A =LeftMouse

D = RightMouse

Q = LeftClick

E = RightClick.

I'm sure if you study the code it will help.

Share this post


Link to post
Share on other sites

Simple...

HotKeySet( "w", "_UpArrow")
HotKeySet( "s", "_DownArrow")
HotKeySet( "a", "_Leftarrow")
HotKeySet( "d", "_RightArrow")
HotKeySet( "q", "_LeftClick")
HotKeySet( "e", "_RightClick")
HotKeySet( "{F10}", "_Close")
$x = 100
$y = 100
$z = -1
MouseMove($x, $y)
While 1
    If $z = 0 Then
        Exit
    EndIf
Wend
Func _UpArrow()
    $y = $y - 10
    MouseMove($x, $y, 0)
EndFunc;==>_UpArrow
Func _DownArrow()
    $y = $y + 10
    MouseMove($x, $y, 0)
EndFunc;==>_DownArrow
Func _Leftarrow()
    $x = $x - 10
    MouseMove($x, $y, 0)
EndFunc;==>_Leftarrow
Func _RightArrow()
    $x = $x + 10
    MouseMove($x, $y, 0)
EndFunc;==>_RightArrow
Func _LeftClick()
    MouseClick( "left", $x, $y, 1, 0)
EndFunc;==>_LeftClick
Func _RightClick()
    MouseClick( "right", $x, $y, 1, 0)
EndFunc;==>_RightClick
Func _Close()
    $z = 0
    Exit
EndFunc;==>_Close

W = UpMouse

S = DownMouse

A =LeftMouse

D = RightMouse

Q = LeftClick

E = RightClick.

I'm sure if you study the code it will help.

Thanks AutoIt Smith..

its very usefull!! B)

More Power!! :o


Umbrella Member

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