help with mouse clicking script

Ask gaming related questions (AHK v1.1 and older)
BBE24
Posts: 4
Joined: 20 Feb 2018, 17:39

help with mouse clicking script

20 Feb 2018, 17:44

Hi all. I'm looking for some help with making a mouseclick script that will basically do three left mouse clicks as fast as possible in 3 different positions on the screen

I would like ctrl+1 to be the hotkey and then have one click at coordinance 171, 472. followed by one click at 702, 692. then followed by the last click at 972, 136.

I've been reading the tutorial for a better part of 3 to 4 hours and I just can't quite get it right and figure it out.

Thanks

Also if someone thinks the click command is better for this than mouseclick, I'm all for that too. I didn't see anywhere to enter in the speed with the click command and since I wanted it to be relatively swift, I went with mouseclick instead.
wolf_II
Posts: 2688
Joined: 08 Feb 2015, 20:55

Re: help with mouse clicking script

20 Feb 2018, 20:17

Are you asking where in the docs you find an example? https://autohotkey.com/docs/commands/Se ... tm#Example
BBE24
Posts: 4
Joined: 20 Feb 2018, 17:39

Re: help with mouse clicking script

20 Feb 2018, 22:53

No. I was asking for someone to help me create the script that will do what I described. I don't understand coding too well and don't honestly have a huge need or desire to learn how to code. This is a pretty obscure one time need to be able to accomplish something for my company.
gregster
Posts: 9000
Joined: 30 Sep 2013, 06:48

Re: help with mouse clicking script

21 Feb 2018, 00:31

Well, usually the likelihood to get help is much higher if you show that you are you willing to try (although you might still find a charitable mind, especially if it doesn't seem to be an awfully complex script) - even if there is no "huge need" or "desire" on your side... because the same could also be true for your potential helpers who are all volunteers and perhaps are tired of the request for the umpteenth click-script (and not working for your company like you).

Show what you tried, tell us what the code did and what didn't work. It also wouldn't hurt to give some information about the goal of these clicks and in which application they should be registered.
BBE24
Posts: 4
Joined: 20 Feb 2018, 17:39

Re: help with mouse clicking script

21 Feb 2018, 07:49

fair enough. Unfortunately it's pretty embarrassing as I dd not get much beyond the basic test script. The "my first script" worked for me. But then I couldn't even get the ftw free the whales hotstring to work. Initially I started with just trying and being happy to have gotten one mouse click to work and my script looked like this:

^1::
Mouseclick, [, left, 171, 472, 1, 0]
Return

This returned an error when trying to save the script. This is about the time I realized I might be a bit out of my league here. It's actually not for gaming, it's for a POS check out screen. Basically think of a mcdonalds cashier station where the cashiers screen has all the different buttons on it like big mac, fries, etc... That is basically what we have, and I was looking for a hot key that could click on 3 different buttons on the screen in order to complete a full checkout process of a commonly purchased item for my employees.
gregster
Posts: 9000
Joined: 30 Sep 2013, 06:48

Re: help with mouse clicking script

21 Feb 2018, 08:15

Well, I personally never had a real use case for a click script, so I might not be the best adviser here. But perhaps I can get you a little bit further.
From the docs (https://autohotkey.com/docs/Concepts.htm#functions):
Square brackets signify that the enclosed parameters are optional (the brackets themselves should not appear in the actual code)

That means, the syntax should rather be:

Code: Select all

^1::
Mouseclick, left, 171, 472, 1, 0
Return
A look into the example section can sometimes help, too, if in doubt about the syntax (https://autohotkey.com/docs/commands/Mo ... m#Examples)
Also note:
Coordinates are relative to the active window unless CoordMode was used to change that. If omitted, the cursor's current position is used.
(From MouseClick) So, are these coordinates you are using screen or window coordinates?

Does that work for your use case? Does Click work better?
For certain window control/elements you can also use ControlClick - if it works, it can be more reliable, especially if the position of a control can change.
BBE24
Posts: 4
Joined: 20 Feb 2018, 17:39

Re: help with mouse clicking script

22 Feb 2018, 11:00

Believe it or not that actually worked. I had the code right the whole time, just needed to delete the brackets. Works great! Thanks!

Return to “Gaming Help (v1)”

Who is online

Users browsing this forum: No registered users and 60 guests