Cannot recognize the correct image

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
stearno
Junior Coder
Posts: 22
Joined: Sun Jul 26, 2020 4:15 am

Cannot recognize the correct image

Post by stearno » Mon Aug 03, 2020 11:32 am

My Objective: I want MS to find the correct image, and click on it.

But no matter what the settings, it either doesn't find it or selects the wrong one. I have tried to figure this out for a week and stumped.

If I run Debug, and click thru each line, it finds the correct image everytime. So I have slowed down the code by putting Waits, but still finds wrong image when code is run from the beginning.

I have attached the image I want (monster.bmp)
monster.png
and the image it always chooses (when start from beginning) (5mTrend.bmp
5mTrend.png
). But I had to attached the png files as bmps are not allowed.

I have tried to set it to Exact with setting of 0-50, in increments of 5. I have set to Cooeff with setting 1-0.7. It still finds the wrong image. I have tried Screen, window, and even a rectangle.

I have also attached the code
image find code.scp
.

stearno
Junior Coder
Posts: 22
Joined: Sun Jul 26, 2020 4:15 am

Re: Cannot recognize the correct image

Post by stearno » Mon Aug 03, 2020 11:35 am

It only allowed 1 attachment.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Cannot recognize the correct image

Post by Dorian (MJT support) » Mon Aug 03, 2020 12:16 pm

I noticed in your other FindImagePos SRTs you have a tolerance of 50, but this one is 0. Of course with 0 this means a perfect match is required. What happens if you increase your tolerance?
Yes, we have a Custom Scripting Service. Message me or go here

stearno
Junior Coder
Posts: 22
Joined: Sun Jul 26, 2020 4:15 am

Re: Cannot recognize the correct image

Post by stearno » Mon Aug 03, 2020 12:38 pm

Yes. That was testing in debug mode. I was testing what tolerance works. In Debug mode, up to 50 works. Then when run macro from beginning with Start, it will recognize the other image.

That is why I reduced that one to 0,to see if "an exact match" would fix it. But it still would click on the 5mTrend image, even at 0 tolerance.

User avatar
Dorian (MJT support)
Automation Wizard
Posts: 1348
Joined: Sun Nov 03, 2002 3:19 am
Contact:

Re: Cannot recognize the correct image

Post by Dorian (MJT support) » Mon Aug 03, 2020 1:05 pm

Do you know for sure it's jumping to that subroutine? Try turning logging on to to make sure it's actually looking for that image in the first place. If it isn't, that will explain why it'll find it when you debug that isolated part of the script, but doesn't when you run the whole thing.
Yes, we have a Custom Scripting Service. Message me or go here

Post Reply
Sign up to our newsletter for free automation tips, tricks & discounts