mdude186 Posted July 28, 2009 Posted July 28, 2009 i was wondering what the script would be if i wanted to have my mouse move to a position and click when i click a button. all i have right now is.. HotKeySet("1", "Main") Func Main() If _IsPressed(31) Then ; If 1 key is pressed MouseMove(732, 691) MouseDown("left") MouseUp("left") EndIf _IsPressed(60) EndFunc this does not work....my ideal situation would be if i press the s key the mouse moves to (732, 691) and clicks. And then the script ends when i push the d key. Thank you, mdude186
Rarst Posted July 28, 2009 Posted July 28, 2009 (edited) I am not sure about how you want to trigger and stop, try something like this: #Include <Misc.au3> HotKeySet("1", "Main") While 1 Sleep(100) WEnd Func Main() Do MouseClick("left",200,200) Sleep(1000) Until _IsPressed("60") EndFunc When you press 1 it will start clicking every second until key with code 60 (numpad 0 according to help file) is pressed (it must get to checking for it after that 1s pause). Edited July 28, 2009 by Rarst AutoIt tag at Rarst.net
mdude186 Posted July 28, 2009 Author Posted July 28, 2009 Well...the mouse moves lol. But when i try to take it away from that spot it goes right back without me doing anything. It took a bit of effort to shut the script off lol...What i'm specifically looking for is. When i push the s key the mouse will click on that spot. Thats all. And i can do that over and over with out the script shutting off. but after i hit the s key it clicks and stops so i can move the mouse freely again.
Rarst Posted July 28, 2009 Posted July 28, 2009 I probably coded too much because your initial code was overcomplicated. You want one click each time you press hotkey, correct? #Include <Misc.au3> HotKeySet("1", "Main") While 1 Sleep(100) WEnd Func Main() MouseClick("left",732, 691) EndFunc AutoIt tag at Rarst.net
mdude186 Posted July 28, 2009 Author Posted July 28, 2009 Well it works! Thank for your help. But i was wondering one more thing. Is there a way to make it so the mouse moves and clicks almost instantly? so in other words a way to change the speed to go very fast. Thank you again, mdude
H3x Posted July 28, 2009 Posted July 28, 2009 Yea, just modify the MouseClick() function #Include <Misc.au3> HotKeySet("1", "Main") While 1 Sleep(1) WEnd Func Main() MouseClick("left",732, 691, 1, 1) EndFunc
mdude186 Posted July 28, 2009 Author Posted July 28, 2009 Oh well thank you all very much!! It is greatly appreciated.
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now