Switch case for image recognition?

I’m working on a macro that needs to identify 1 of 15 different images, and perform a different action for each image found.

Right now, I have it doing:
"Pause until conditions met"
then have 15 conditions (one for each image).
Then when one of the images appears on the screen, it performs the action specific for that image and waits again.
This really isn’t a problem, but the only way I can find to do this is to have a bunch of If/else. I’d like to use a switch case instead but can’t figure out how to do that with image conditions. The only option is clipboard.

Can you post some of the macro? I understand the basic concept of what you’re trying to do, but more details would help with coming up with a solution.

If I understand it correctly, you want to continuously look for any of 15 images, and if any of them appear perform some action that is specific to the image?

There is no particularly good solution to this. The best is simply do do:

  • While calculation 1
    • if find image 1
      • do stuff 1
    • if find image 2
      • do stuff 2
    • Pause N seconds

The pause at the end should be as large as you can manage and still be happy with the response time to minimise the load, but the load will likely be significant.

Hi peter,
That is slightly different than what I had and it sounds like it will work
slightly faster.
Unfortunately, the bot is for testing a game and the screen changes every 3
seconds. I tested my original program against the game code and it was
particularly slow. I will try this and hopefully it will speed things up a
bit. Thanks!

Depending on your computer’s performance, the size and uniqueness of your images, and the size of the search area, you may find that searching for that many images can’t be done in 3 seconds. Good luck.