ScreenCapture Cmd vs Image Capture Tool with FindImagePos

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
gtdalsanto
Pro Scripter
Posts: 51
Joined: Tue Oct 03, 2006 4:22 pm
Location: Akron, Ohio
Contact:

ScreenCapture Cmd vs Image Capture Tool with FindImagePos

Post by gtdalsanto » Fri Mar 28, 2008 4:40 pm

I have a script that when it executes at run time, it goes out and performs screencaptures on all the labels/objects when the screen originally comes up. It does this for all the labels I need to find the position using the findimagepos command. I do this to correct for different video cards that the script may run be run on so I don't have to manually capture all the images again.

The problem I am having is that it is failing to find the image captured by the ScreenCapture command. At first I thought it was a timing issue, and put some delays between my screencapture commands. I originally used the new SCREEN variable in the FindImagePos, and found it was not reliable, in that it sometimes failed finding the image. So I went back to getting the screen resolution, then running the ScreenCapture command to capture the screen like I previously did, and this seemed to make the not found errors to come down dramatically.

Now I am performing the screen capture command on a Microsoft Access form that has a white background with black text. Not sure if this could be the problem. But what I did was let the screen capture command create the object bitmap of the label, then I performed another screencapture command to get the screen, then I executed the findimagepos command on the two files, with it failing. However, using the same screen.bmp file, and capturing the label/object with the Image Capture tool, the FindImagePos command works everytime.

Looking at the two files zoomed in a bitmap viewer (one created by screencapture and the other by the Image Capture Tool), it seems as if the images are not as sharp, where one visually has black pixels missing (the one from the ScreenCapture command).

Is there a parameter I need to set before running the screen capture to make the bitmap the same quality as the one captured when I do the complete screen? It seems as if this is a bug in the screencapture command.

One added note, if I change the color tolorance parameter to 80, it will find it, but it then returns multiple items at times for the value. I am trying to use the findimagepos with color tolerance as zero because I want to find an exact match. Since I am creating the bitmaps at runtime, this should in theory work. Am I doing something wrong here?

As always, thanks for your help.

Gary
Gary T. DalSanto
Inventive Software Designs, LLC
[email protected]

User avatar
Marcus Tettmar
Site Admin
Posts: 7380
Joined: Thu Sep 19, 2002 3:00 pm
Location: Dorset, UK
Contact:

Post by Marcus Tettmar » Fri Mar 28, 2008 4:46 pm

ScreenCapture uses the exact same code to capture the image and save it to a bmp as does the image capture tool. I just checked the code and don't see a difference.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?

spikeinin
Newbie
Posts: 1
Joined: Thu Aug 06, 2009 12:47 pm

Post by spikeinin » Thu Aug 06, 2009 12:51 pm

I am assuming the awning abduction command on a Microsoft Access anatomy that has a white accomplishments with atramentous text. But what I did was let the awning abduction command actualize the article bitmap of the label, again I performed addition screencapture command to get the screen, again I accomplished the findimagepos command on the two files, with it failing.


_________________
Call center software

gdyvig
Automation Wizard
Posts: 447
Joined: Fri Jun 27, 2008 7:57 pm
Location: Seattle, WA

awning abduction

Post by gdyvig » Thu Aug 06, 2009 3:49 pm

Hi spikeinin,

I am not familiar with the term "awning abduction". I googled it and found that it appears to refer to screen image capture tools of various types.

The Image Capture Tool always captures bmp images which are lossless.

The ScreenCapture command gives you a choice of bmp (lossless) and jpg (lossy).

Any other capture tools that which are lossy or alter the captured image may not work well with FindImagePos. The documentation says FindImagePos is for bitmap files which I assume to be bmp files. Have not tried it with jpg.

Any capture tool which is lossy may nonatramentous text as dithering may occur at the edges of the text.

If you return the script on another machine with Font Smoothing effect turned on the screen will display nonatramentous text, the font smoothing produces an effect that appears similar to dithering but results in a more pleasing display on LCD monitors.


In conclusion:
Always use bmp files with FindImagePos.
If possible use the Image Capture Tool and ScreenCapture command.
If images are captured from other sources you will need to analyse and test them to ensure compatibility with FindImagePos.


Gale

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