Questions regarding multiple Imagesearches in a list

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

Questions regarding multiple Imagesearches in a list

22 Aug 2017, 20:47

Hello,

I have a question about ImageSearch. So let's say I have six images (Images A, B, C, D, E, F) and I have a script that said that if at least two of those six images were present, it would do something like send right mouse button.

How would I go about this? I know I could make a looong script that involves a lot of errorlevels, but there has to be a better, more efficient way. Something with a lot of {or} commands or something?

Also, is there any way to make my script from above not happen if another image is present (Image 6)? So even if at least two of Images A, B, C, D, E, or F are present, it doesn't do anything as long as Image 6 is present.
User avatar
Blackholyman
Posts: 1293
Joined: 29 Sep 2013, 22:57
Location: Denmark
Contact:

Re: Questions regarding multiple Imagesearches in a list

23 Aug 2017, 05:39

example:

Code: Select all

images := ["c:\image1.jpg","c:\image2.jpg","c:\image3.jpg","c:\image4.jpg","c:\image5.jpg"]
images_found:=0

for key, value in images
{
    ImageSearch, OutputVarX, OutputVarY, 0, 0, A_Width, A_Height, *30 c:\image6.jpg
    if (Errorlevel != 0)
    {
        ImageSearch, OutputVarX, OutputVarY, 0, 0, A_Width, A_Height, *30 %value%
        if (Errorlevel = 0)
            images_found++
    }
    sleep 100
}
if (images_found >= 2)
    MouseClick, R
Also check out:
Courses on AutoHotkey

My Autohotkey Blog
:dance:
Imagesearcher

Re: Questions regarding multiple Imagesearches in a list

23 Aug 2017, 09:53

Blackholyman wrote:example:

Code: Select all

images := ["c:\image1.jpg","c:\image2.jpg","c:\image3.jpg","c:\image4.jpg","c:\image5.jpg"]
images_found:=0

for key, value in images
{
    ImageSearch, OutputVarX, OutputVarY, 0, 0, A_Width, A_Height, *30 c:\image6.jpg
    if (Errorlevel != 0)
    {
        ImageSearch, OutputVarX, OutputVarY, 0, 0, A_Width, A_Height, *30 %value%
        if (Errorlevel = 0)
            images_found++
    }
    sleep 100
}
if (images_found >= 2)
    MouseClick, R
Thank you so much! I'll test it tomorrow and tell you the results :)

Return to “Ask for Help (v1)”

Who is online

Users browsing this forum: No registered users and 215 guests