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?
WaitScreenImage Not Working With ScreenShot
Moderators: Dorian (MJT support), JRL
WaitScreenImage Not Working With ScreenShot
Thanks,
Josh
Josh
- Grovkillen
- Automation Wizard
- Posts: 1131
- Joined: Fri Aug 10, 2012 2:38 pm
- Location: Bräcke, Sweden
- Contact:
Re: WaitScreenImage Not Working With ScreenShot
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.
So your solution needs to be made on "new screenshot per new machine" premises I'd say. Or choose another approach.
Re: WaitScreenImage Not Working With ScreenShot
I agree with Grovkillen. You're dealing with an image, not a bit of text.ueberyak wrote: It's just 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.
Re: WaitScreenImage Not Working With ScreenShot
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!
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!