Issue on FindImagePos

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
159876543210
Newbie
Posts: 3
Joined: Mon Feb 07, 2011 2:21 am

Issue on FindImagePos

Post by 159876543210 » Mon Feb 07, 2011 4:26 am

Im trying to find an image on screen and captured the BMP using Macro Scheduler's Image Capture Tool.

Code: Select all

FindImagePos>C:\image.bmp,SCREEN,0,1,X,Y,NumFound
    If>NumFound>0
        MessageModal>found
    Else
        MessageModal>not found
    EndIf
However, the result is always not found eventhough I tried the tolerance level to 255 from 0.

I use Tolerance Tester and the result is match...

Any idea what causing this?


Thank you.

Regards,
Wong

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

Post by JRL » Mon Feb 07, 2011 5:48 am

The posted script works flawlesslt for me. What version of Macro Scheduler are you using? Also, Visually inspect the image.bmp file and be sure that you can see an identical area on the screen.

159876543210
Newbie
Posts: 3
Joined: Mon Feb 07, 2011 2:21 am

Post by 159876543210 » Mon Feb 07, 2011 6:45 am

thank you for the quick reply!

Im using version 12.0.7e.

tried this

[textcode]
GetScreenRes>w,h
ScreenCapture>0,0,w,h,d:\screen.bmp
CompareBitmaps>d:\img.bmp,d:\screen.bmp,match
MessageModal>%match%
[/textcode]

it returns -1 as well.

just test with Tolerance Tester again and this is the result

1 = Tolerance required to find this needle.
1 = Number of needles found.
796 = Needle X Position.
368 = Needle Y Position.

armsys
Automation Wizard
Posts: 1108
Joined: Wed Dec 04, 2002 10:28 am
Location: Hong Kong

Post by armsys » Mon Feb 07, 2011 11:30 am

I test your script with 2 steps:
Step 1
GetScreenRes>w,h
ScreenCapture>0,0,w,h,C:\Temp\screen1.bmp

Step 2
GetScreenRes>w,h
ScreenCapture>0,0,w,h,C:\Temp\screen2.bmp
CompareBitmaps>C:\Temp\Screen1.bmp,C:\Temp\Screen2.bmp,match
MessageModal>match

The match always returns a positive number greater than 0.
That's, your script works fine.
Just make sure no trailing spaces.
Last edited by armsys on Mon Feb 07, 2011 2:32 pm, edited 1 time in total.

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

Post by Marcus Tettmar » Mon Feb 07, 2011 1:39 pm

Where is img1.bmp coming from? Have you captured it using the built-in image capture tool? Have you read this:
http://www.mjtnet.com/blog/2009/02/13/i ... -mistakes/
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

159876543210
Newbie
Posts: 3
Joined: Mon Feb 07, 2011 2:21 am

Post by 159876543210 » Mon Feb 07, 2011 4:21 pm

I captured the image using the built in tool and the background using SCREEN

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