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?
FindImagePos not recognizing needle image in taskbar
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
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.
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?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?