FindImagePos not recognizing needle image in taskbar

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Brett
Newbie
Posts: 5
Joined: Tue Sep 18, 2007 7:38 pm

FindImagePos not recognizing needle image in taskbar

Post by Brett » Thu Sep 20, 2007 4:09 pm

I want a script that starts off by taking a screenshot of the desktop with all windows minimized and then opens a window by choosing it from the taskbar at the bottom of the screen.

Here's my code:

//DESKTOP SCREENSHOT & CLICK ON MINIMIZED INVENTORY
GetScreenRes>sX,sY
ScreenCapture>0,0,sX,sY,C:\PrintPickTicket\Desktop.bmp
FindImagePos>C:\PrintPickTicket\Inventory_taskbar.bmp,C:\PrintPickTicket\Desktop.bmp,100,1,XPos,YPos,imgs
If>imgs>0
Mousemove>XPos_0,YPos_0
LClick
EndIf

WaitScreenImage>C:\PrintPickTicket\InventoryTitle.bmp
MessageModal>DID IT WORK?


It takes the desktop screenshot and saves it correct as you can see here
http://img.photobucket.com/albums/v308/ ... esktop.jpg

It's supposed to be looking for this needle image:
http://img.photobucket.com/albums/v308/ ... askbar.jpg
which you can see clearly on the bottom of the screen

I've tried changing the image recognition tolerance level from 20 to 100 and no luck. I wait about 20 seconds and never see my MessageModal popup at the end so it's getting stuck somewhere.

The log doesn't show any errors, it just lists the steps

Can anyone give me a hand with figuring out why?

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

Post by Marcus Tettmar » Thu Sep 20, 2007 4:16 pm

How did you capture Inventory_taskbar.bmp? Be sure to use Macro Scheduler's own image capture tool to compare like with like. Other tools may output a different color depth etc. The capture tool is in the editor under Edit/Image Capture Tool and is also available from the Image Recognition code builder dialogs.

It's possible it IS finding the image, but it could be finding more than one match. And it could be that the first match (0,0) is not the one you want. Set color tolerance to 0 (ZERO) and ensure the bitmap you are searching for is specific with not too much generic color (background/shared colors).

What is the value of imgs when you step through with the debugger?

Feel free to send me your Inventory_taskbar.bmp and Desktop.bmp (Not the JPG files - send me the raw BMP files you are using and are generated by your script). Then I can tell you what might be happening.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

Brett
Newbie
Posts: 5
Joined: Tue Sep 18, 2007 7:38 pm

Post by Brett » Thu Sep 20, 2007 5:00 pm

Aha!!! I took the screenshots for some of these images with a different program and that proved to be the problem!

As soon as I replaced them using MS Pro cature tool the first part of the script ran successfully!

Thanks for the quick response!!

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