Click image in random location Topic is solved

Get help with using AutoHotkey (v1.1 and older) and its commands and hotkeys
Silverfish

Click image in random location

30 Jul 2017, 17:45

I am trying to click an image (always the same image) in various spots. For some reason, I run the script and absolutely nothing happens! I assume use:

ImageSearch, OutputVarX, OutputVarY, X1, Y1, X2, Y2, ImageFile
Click, %OutputVarX%, %OutputVarY%

OutputVarX/Y would be where it found the image and X1/Y1 are the "upper left" of the box and X2/Y2 are the "lower right". ImageFile is the name of the file with the file path.

Anyone see any issues here?

Thanks!
Vh_
Posts: 203
Joined: 17 Mar 2017, 22:06

Re: Click image in random location

30 Jul 2017, 18:00

If you are posting exact code, off the top sight i see an error. Should be:

"..., ImageFile.png ;or what ever extention

Edit:

Also could be that the location you are searching has anti macro measures if a game.
fug5333
Posts: 32
Joined: 03 May 2016, 08:55

Re: Click image in random location  Topic is solved

30 Jul 2017, 18:16

The exact script I'm using is:

#+z::
ImageSearch, outx, outy, 4900, 660, 5050, 820, like.jpg
MouseMove %outx%, %outy%
Click


Absolutely nothing. :/ The reason the x coords are so high is because it's on a second monitor by the way.

Thanks!
User avatar
Masonjar13
Posts: 1555
Joined: 20 Jul 2014, 10:16
Location: Не Россия
Contact:

Re: Click image in random location

30 Jul 2017, 18:22

If there's any variance between the image on the screen and the image file, it won't work. Meaning, if you compressed the image, it will have variation and won't work. You should always use uncompressed images (png). You may also try setting the variation parameter for ImageSearch.
OS: Windows 10 Pro | Editor: Notepad++
My Personal Function Library | Old Build - New Build
fug5333
Posts: 32
Joined: 03 May 2016, 08:55

Re: Click image in random location

30 Jul 2017, 19:20

'sigh' Still nothing. Here's the updated script:

CoordMode Pixel
CoordMode Mouse
ImageSearch, outx, outy, 1100, 640, 1160, 830, like.png *50
MouseMove %outx%, %outy%

Thanks!
User avatar
Exaskryz
Posts: 2882
Joined: 17 Oct 2015, 20:28

Re: Click image in random location

30 Jul 2017, 19:34

Try some diagnostics with MsgBox % ErrorLevel and see what the ImageSearch command is setting the error to. Also, double check your CoordMode; the default is Screen and you were talking about having such a high X value before.
User avatar
Xtra
Posts: 2750
Joined: 02 Oct 2015, 12:15

Re: Click image in random location

30 Jul 2017, 19:35

To use variance it should be like this:

Code: Select all

ImageSearch, outx, outy, 1100, 640, 1160, 830, *50 like.png

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: doodles333 and 316 guests