Sign in to follow this  
Followers 0
cdkid

mouse control

10 posts in this topic

#1 ·  Posted (edited)

this is a little useless script i made when i was bored... mouse control

arrow keys to move mouse, + key on the numpad to click, and \ to right click:

while 1
HotKeySet("{UP}","up")
HotKeySet("{DOWN}","down")
HotKeySet("{LEFT}","left")
HotKeySet("{RIGHT}","right")
HotKeySet("{NUMPADADD}","click")
HotKeySet("\","rclick")
wend

func up()
local $array = MouseGetPos()
    local $x = $array[0]
    local $y = $array[1] - 15
    mousemove($x,$y,2)
endfunc

func down()
    local $array = MouseGetPos()
    local $x = $array[0]
    local $y = $array[1] + 15
    mousemove($x,$y,2)
EndFunc

func left()
    local $array = MouseGetPos()
    local $x = $array[0] - 15
    local $y = $array[1]
    mousemove($x,$y,2)
EndFunc

func right()
    local $array = MouseGetPos()
    local $x = $array[0] + 15
    local $y = $array[1]
    mousemove($x,$y,2)
endfunc

func click()
    mouseclick("left")
EndFunc

Func rclick()
    mouseclick("right")
EndFunc
Edited by cdkid

AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Share this post


Link to post
Share on other sites



Simply awesome

Share this post


Link to post
Share on other sites

lol i made the same script wen i was bored a little while ago. the clicking is kinda messed up for me tho when i click on icons.

Share this post


Link to post
Share on other sites

Based on your Code, I added some diagnals to this. Using a standard Keyboard, you can use Home, End, Pgup and Pg Down on an old-style keyboard. I added to the code, + an exit function to use the ESC Key to exit.

Cool idea to feed off. Thanks for the code!

while 1
;normal updownleftright
HotKeySet("{ESC}", "endit")
HotKeySet("{UP}","up")
HotKeySet("{DOWN}","down")
HotKeySet("{LEFT}","left")
HotKeySet("{RIGHT}","right")
;diags
HotKeySet("{HOME}","upleft")
HotKeySet("{END}","downleft")
HotKeySet("{PGUP}", "upright")
HotKeySet("{PGDN}", "downright")


HotKeySet("{NUMPADADD}","click")
HotKeySet("\","rclick")
wend

func up()
local $array = MouseGetPos()
    local $x = $array[0]
    local $y = $array[1] - 15
    mousemove($x,$y,2)
endfunc

func down()
    local $array = MouseGetPos()
    local $x = $array[0]
    local $y = $array[1] + 15
    mousemove($x,$y,2)
EndFunc

func left()
    local $array = MouseGetPos()
    local $x = $array[0] - 15
    local $y = $array[1]
    mousemove($x,$y,2)
EndFunc

func right()
    local $array = MouseGetPos()
    local $x = $array[0] + 15
    local $y = $array[1]
    mousemove($x,$y,2)
endfunc


func upleft()
local $array = MouseGetPos()
    local $x = $array[0] - 15
    local $y = $array[1] - 15
    mousemove($x,$y,2)
endfunc

func downleft()
    local $array = MouseGetPos()
    local $x = $array[0] - 15
    local $y = $array[1] + 15
    mousemove($x,$y,2)
EndFunc

func upright()
local $array = MouseGetPos()
    local $x = $array[0] + 15
    local $y = $array[1] - 15
    mousemove($x,$y,2)
endfunc

func downright()
local $array = MouseGetPos()
    local $x = $array[0] + 15
    local $y = $array[1] + 15
    mousemove($x,$y,2)
endfunc


func click()
    mouseclick("left")
EndFunc

Func rclick()
    mouseclick("right")
EndFunc

func endit()
    exit
EndFunc

Share this post


Link to post
Share on other sites

thanks :P


AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Share this post


Link to post
Share on other sites

only thing i couldnt figure out was how to click & drag.... :P


AutoIt Console written in C#. Write au3 code right at the console :D_FileWriteToLineWrite to a specific line in a file.My UDF Libraries: MySQL UDF Library version 1.6 MySQL Database UDF's for AutoItI have stopped updating the MySQL thread above, all future updates will be on my SVN. The svn location is:kan2.sytes.net/publicsvn/mysqlnote: This will still be available, but due to my new job, and school hours, am no longer developing this udf.My business: www.hirethebrain.com Hire The Brain HireTheBrain.com Computer Consulting, Design, Assembly and RepairOh no! I've commited Scriptocide!

Share this post


Link to post
Share on other sites

Maybe set a different button to hold mouse, and another button to let the mouse up. For example like this....

HotKeySet("RALT}", "Mdown")
HotKeySet("RCTRL}", "Mup")

Func Mdown()
     MouseDown("left")
EndFunc

Func Mup()
     MouseUp("left")
EndFunc

You only need one control and alt anyways lol, then you just hafta find more keys to use for the right click.

(if you cant tell, this holds down the left mouse button when pressing the right Alt button, and lets go of the left mouse botton when you press the right Ctrl button)

Not sure if this will work because i havent tried it, but in theory it should be perfectly fine.

Share this post


Link to post
Share on other sites

why not just send ALT+SHIFT+NUMLOCK :P

and control it with the keypad.

Because it's always funner knowing you made it yourself lol

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