Bit map not reading...

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
ckhokie
Newbie
Posts: 6
Joined: Fri May 23, 2008 4:28 pm
Location: USA

Bit map not reading...

Post by ckhokie » Thu Jul 31, 2008 5:55 pm

Hi! I'm having an issue with my macro reading a bit map correctly. When I step through the code it finds the selection every time. But when I let it run it never finds it.

I have captured the bit map numerous times but have not gotten it to work. In the same code I search and select about a dozen other bit maps so I think I'm doing the bit map capture part correctly. I'm using this part in my code to increase the pixels:

//Set FIP_SCANPIXEL to force the FindImagePos to compare every pixel.
Let>FIP_SCANPIXELS=1677

Here is the code that I'm using to ID the bit map:

WaitScreenImage>c:\Multi SSN P1.bmp
Wait>5.0
FindImagePos>c:\Multi SSN P1.bmp,SCREEN,20,0,X,Y,NumFound
If>NumFound>0
MouseMove>X_0,Y_0
LClick
Endif

Any help is greatly appreciated!

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

Post by Marcus Tettmar » Sun Aug 03, 2008 7:08 am

The fact that it works when you step through it but not when you run it tells me that this is a timing issue. When you debug and step through it you are drastically slowing the script down.

Looking at your code my guess is that between the WaitScreenImage and FindImagePos, during that 5 second wait, the image is no longer on the screen. Another possibility is that you need to use 0 for the colour tolerence. WaitScreenImage uses 0, but your FindImagePos is using 20.

Perhaps the object you are looking for is still there, but in those 5 seconds something has changed it's appearance subtly. Maybe focus has changed - focused objects are often very slightly different to non-focused objects.

A good way to understand what is happening is to use ScreenCapture before the FindImagePos command. That way you can look at the captured screen and see what Macro Scheduler is seeing. Zoom the captured image and compare closely to what you are looking for. You'll find there's a difference if FindImagePos is failing to find it.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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