WaitScreenImage Not Working With ScreenShot

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
ueberyak
Junior Coder
Posts: 31
Joined: Tue Sep 03, 2013 9:45 pm

WaitScreenImage Not Working With ScreenShot

Post by ueberyak » Tue Apr 16, 2024 9:55 pm

Good Day!

I am using WaitScreenImage successfully on one of my computers, using a screenshot I took from SAP. The screenshot is just a notification that there is no data selected for the SAP script. When I compile the script as an EXE and include the image we're trying to locate, everything still works on my computer. However, when I share the image and EXE with a coworker, the WaitScreenImage portion fails. To rectify this, I had the other user take a new screenshot from her computer and copy it over the image I originally created. When she uses her own screenshot, WaitScreenImage works again! I tried lowering the CCOEFF value below 7.0 but then the script doesn't work properly, overlooking instances where there is actually data and the image we're searching for is not present.

I'm not clear why using a second screenshot of the same text works on one computer but not the other. It's just a bit of text. What am I missing?
Thanks,
Josh

User avatar
Grovkillen
Automation Wizard
Posts: 1024
Joined: Fri Aug 10, 2012 2:38 pm
Location: Bräcke, Sweden
Contact:

Re: WaitScreenImage Not Working With ScreenShot

Post by Grovkillen » Wed Apr 17, 2024 4:20 am

Graphics are not consistent. I tend to only use this approach on known machines that I myself have control over. Most likely the resolution isn't close enough to your machine's resolution.

So your solution needs to be made on "new screenshot per new machine" premises I'd say. Or choose another approach.
Let>ME=%Script%

Running: 15.0.24
version history

User avatar
JRL
Automation Wizard
Posts: 3501
Joined: Mon Jan 10, 2005 6:22 pm
Location: Iowa

Re: WaitScreenImage Not Working With ScreenShot

Post by JRL » Wed Apr 17, 2024 1:23 pm

ueberyak wrote: It's just a bit of text
I agree with Grovkillen. You're dealing with an image, not a bit of text.

There are things you can do with your original screen capture to increase your chances of success. First make sure you capture to a BMP file and not a JPG. JPGs are not an exact file. Second, Capture as small an area as possible that will still ensure you have a unique image. Third, don't include any pixels outside the desired message window.

Make sure all graphic property details are identical on any computers you want this image to be detected on. Even hardware discrepancies can make the image different enough to fail. If your SAP is running through an RDP or Citrix or other remote viewing session, all of that software's settings related to graphics must be identical on all computers detecting the image.

Also, as Grovkillen said, your best bet is to not use an image but if its an absolute necessity, capturing the image on each computer, as you've done, is your most likely path to success.

robsmith
Newbie
Posts: 16
Joined: Mon Oct 30, 2023 2:12 pm
Location: USA

Re: WaitScreenImage Not Working With ScreenShot

Post by robsmith » Sat Apr 20, 2024 2:31 am

Try changing the images you use to find more stable areas of the screen or change when you capture the images.
The color depth, screen resolution, and so many other things make it a real challenge, as JRL and Grovkillen explained.
The percentage of times that it fails when carefully used is amazingly low, but frequent enough that it has driven me to find alternative methods.

If UIAccessibleList works with SAP (I have no idea), it might do what you need with the least effort.

If its web-based SAP, injecting javascript commands through the Chrome functions require a specific browser setup, which is still challenging but less so than controlling all the factors which subtly affect image rendering.

The OCRArea command is also great, although when it crashes, you have to restart your automation program.

Combine all the tools together and become all powerful!

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