Image Recognition not working

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
CZ
Newbie
Posts: 18
Joined: Wed Feb 07, 2007 7:51 am

Image Recognition not working

Post by CZ » Mon Feb 02, 2015 3:51 pm

Hello
I am trying to have the mouse click on an item on a web page, however when I activate the code I entered for the macro the mouse moves close to the area of the item, but not right on the item itself. Not sure what I am doing wrong. I used the Image Recognition Wizard to capture the item and then used "FindImagePos" in the Code Builder. The website I was working off of is http://www.exrx.net/Calculators/BodyComp.html and I am trying to get the mouse to click in the middle of the "7 Site" next to the "# of Sites" in the upper left area of the webpage. I also attached the 7 Site.BMP File that I had captured. I have Macro Scheduler Pro Version 13.2.4 and Windows 8.1

Here is my code:

SetFocus>Body Composition - Mozilla Firefox

Let>WSI_TIMEOUT=300
WaitScreenImage>%SCRIPT_DIR%\7 Site_1.bmp


Let>FIP_SCANPIXELS=ALL
FindImagePos>%SCRIPT_DIR%\7 Site_1.bmp,SCREEN,20,1,XArr,YArr,NumFound
If>NumFound>0
MouseMove>XArr_0,YArr_0
LClick
Endif

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

Re: Image Recognition not working

Post by Marcus Tettmar » Tue Feb 03, 2015 1:32 pm

Hi,

Your attachment isn't ... attached. Can you try sending again?

But I do note that the needle is "7 Site_1.bmp" not "7 Site.bmp" as you state - could you be using the wrong file?
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

CZ
Newbie
Posts: 18
Joined: Wed Feb 07, 2007 7:51 am

Re: Image Recognition not working

Post by CZ » Tue Feb 03, 2015 8:34 pm

Hello,

Thank you for getting back to me. Sorry the file name was 7 Site_1.bmp file that I was referring to. I had named the image "7 Site" when I was capturing the image and it automatically saved to 7 Site_1.bmp. So I was using the correct file.

Not sure why but when I try to attach the 7 Site_1.bmp file to this post, I get "The extension bmp is not allowed." So not sure how I can attach it to this post. The image was automatically saved in my Microsoft Paint Program.

I noticed when I ran the macro today that the mouse did not move at all. I did use messagemodal as seen below to see if the 7 Site_1.bmp could be found on the screen and I did get the message - I see you!! So I'm thinking that the image is being found but the mouse wasn't moving to it. So not sure what I'm doing wrong.

If>NumFound>0
MessageModal>I see you!!
Endif

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

Re: Image Recognition not working

Post by Marcus Tettmar » Wed Feb 04, 2015 8:46 am

Look in the watch list to see what the values for XArr_0 and YArr_0 are.

Are you running over a remote desktop/VNC type connection by any chance? Sometimes these don't mirror where Macro Scheduler - on the remote PC - has moved the mouse but when you look at the cursor monitor it HAS actually moved.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

CZ
Newbie
Posts: 18
Joined: Wed Feb 07, 2007 7:51 am

Re: Image Recognition not working

Post by CZ » Thu Feb 05, 2015 7:56 pm

Hello,

Thanks again for your reply. I am not running over a remote desktop/VNC type connection. I finally figured out what the problem was. For whatever reason my Display Settings must have been out of whack. I have it at its default of 125%. So I went down to 100% and the image recognition worked perfectly for me, but the font was really small and hard to read on other programs and on websites. So I tried to see if I could slowly up the % and when I got to the default of 125% it still worked perfectly. The only thing is the font size of the Macro Scheduler is a bit smaller and I'm thinking that maybe for whatever reason my Display caused a problem with Macro Scheduler being able to place exactly where the Image Recognition Item was at in the first place. Anyway it seems to be working very well now.

Thanks for all your help.

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