stn9063 0 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! =) Share this post Link to post Share on other sites
hannes08 39 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] Share this post Link to post Share on other sites
Bert 1,429 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 _____ I'm famous My blog: http://www.vollysinterestingshit.com/ Share this post Link to post Share on other sites
stn9063 0 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) Share this post Link to post Share on other sites
JohnOne 1,603 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. Share this post Link to post Share on other sites