stn9063 Posted May 9, 2012 Share Posted May 9, 2012 Hello, I would like to setup AutoIt to perform a simple left click when prompted by a keystroke. There are 4 different buttons I press repeatedly, all side by side, and it would be quicker if I didn't have to move the mouse and could just enter keystrokes, say numbers 1-2-3-4 or letters a-s-d-f. I have tried these commands but they don't seem to be working for me: HotKeySet("{a}", MouseClick("left", 35, 190)) HotKeySet("{b}", MouseClick("left", 35, 225)) and If Send("a") Then MouseClick("left", 35, 190) If Send("b") Then MouseClick("left", 35, 225) Please help a noob with a simple script! =) Link to comment Share on other sites More sharing options...
hannes08 Posted May 9, 2012 Share Posted May 9, 2012 hi stn9060, if you look at the help file for the HotKeySet function, you'll see that it doesn't accept code but just the name of a function to call. E.g. HotKeySet("^q", "_myMSG") ;--> Calls function _myMSG on pressing CTRL-q Func _myMSG() MsgBox(0, "Wow!", "You've pressed CTRL-q!") EndFunc Regards,Hannes[spoiler]If you can't convince them, confuse them![/spoiler] Link to comment Share on other sites More sharing options...
Bert Posted May 9, 2012 Share Posted May 9, 2012 If the click is on the same item and it isn't in a web page you may want to use controlclick to do what you need. The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
stn9063 Posted May 9, 2012 Author Share Posted May 9, 2012 Thank you Hannes! I have got it working using this script. Do you see any room for improvement or a more efficient script? HotKeySet("a", "Click1") Func Click1() MouseClick ("left", 35, 190) EndFunc HotKeySet("s", "Click2") Func Click2() MouseClick ("left", 35, 225) EndFunc HotKeySet("d", "Click3") Func Click3() MouseClick ("left", 35, 260) EndFunc Sleep(2147483647) Link to comment Share on other sites More sharing options...
JohnOne Posted May 9, 2012 Share Posted May 9, 2012 HotKeySet("a", "Click1") HotKeySet("d", "Click3") HotKeySet("s", "Click2") HotKeySet("x", "_Exit") While 1 Sleep(100) WEnd Func Click1() MouseClick ("left", 35, 190) EndFunc Func Click2() MouseClick ("left", 35, 225) EndFunc Func Click3() MouseClick ("left", 35, 260) EndFunc Func _Exit() Exit EndFunc AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
stn9063 Posted May 9, 2012 Author Share Posted May 9, 2012 Awesome, thanks John Link to comment Share on other sites More sharing options...
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