Using old version 11, having a question combining image recognition + mousemove without cords

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
newuser123
Newbie
Posts: 2
Joined: Sat Jul 07, 2018 3:59 pm

Using old version 11, having a question combining image recognition + mousemove without cords

Post by newuser123 » Sat Jul 07, 2018 4:02 pm

Code: Select all

WaitScreenImage>C:\Users\-\Desktop\bmp\rub.bmp,0
LDown
MouseMove>,
WaitScreenImage>C:\Users\-\Desktop\bmp\mcase.bmp,0
LUp
Are the lines in the code field. Beginner question: How to combine image recognition + mousemove without cords? Moving from bmp1 to bmp2 and performing the mouse task?

Scan to replace cords? The intention is the mouse to go where the image is, perform the task solely through image recognition, no set cords due to items moving around irregularly in an "inventory".

That is already it

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Re: Using old version 11, having a question combining image recognition + mousemove without cords

Post by PepsiHog » Sun Jul 08, 2018 2:13 pm

Hello,
I am going to help you by telling you I have no clue what you are saying. And I will suggest that you clarify what you are asking. Be more descriptive. Tell the full story. If we can't understand your question we can't answer.

Now you ask me, "How does this help me?"

Simple. Every time I say I don't understand and please clarify your question, some other user answers the question.

You ARE welcome. See answer from some other user below. :) (or clarify your question.)

"Without cords" that's a real thumper for me. A wireless mouse? And what does that have to do with it?
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

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

Re: Using old version 11, having a question combining image recognition + mousemove without cords

Post by Marcus Tettmar » Mon Jul 09, 2018 11:57 am

Yes, I'm afraid it makes no sense to me either. When you say you want to click on something without "coords" (which I assume is short hand for "screen coordinates") then I'm wondering what magic you are after ;-)

The whole point of image recognition is that the macro scans the screen to FIND the object and RETURN the screen coordinates. You then use these screen coordinates to interact with the visual thing you looked for. The great thing about this is that it doesn't matter where the thing is on the screen - the macro will find it. So if you don't know where it will be, or it can't be predicted and it may be different each session, or different between design time and run time then it doesn't matter, because image recognition will find it, return the current position and then allow you to click on it.

So you can't do "without coords" but what it DOEs do is let you interact with something without KNOWING what the coords are AHEAD of time.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

User avatar
PepsiHog
Automation Wizard
Posts: 517
Joined: Wed Apr 08, 2009 4:19 pm
Location: Florida

Re: Using old version 11, having a question combining image recognition + mousemove without cords

Post by PepsiHog » Thu Jul 12, 2018 5:24 pm

@Marcus
Good interpreting! I totally didn't get "cords". LOL!

@Newuser123
I think maybe you are asking how to do it without co-ords because you may not have realized the FindImage command gives you the co-ords.

Code: Select all

FindImagePos>%BMP_DIR%\image_1.bmp,SCREEN,0.7,1,XArr,YArr,NumFound,CCOEFF
If>NumFound>0
  MouseMove>XArr_0,YArr_0
  LClick
Endif
If you look in the FindImage line you see XArr and YArr. These are the "cords" of the image you are looking for. More specifically, it is the Left(x), Top(y) corner of the image found on the screen.
Now all that you need to do is use these cords in the mousemove command as above. Of course you don't have to do a LClick, or mousemove. Insert whatever commands you want.

Because there may be more than one set of co-ords, the cords are in an array. The array starts at zero. As you see in the "If" statement they are referred to as XArr_0 and YArr_0. Zero is probably all you will need.

Also to be clear, when you use the wizard it gives you options of where the co-ords will be. Such as Left, Top corner. But you may also choose Center Of Image. And other options as well.

It's easier if you use the FindImage wizard. Just answer the questions. And then click "Insert Code".
Then you can modify the commands in the "If" statement as needed.

I hope this helps you. Good Luck.

Not required, but I would like to hear how your macro works out. Leave a comment here for all of us to see how it worked. Plus sharing your knowledge will help others.
Windows 7

PepsiHog. Yep! I drink LOTS of Pepsi (still..in 2024) AND enjoy programming. (That's my little piece of heaven!)

The immensity of the scope of possibilities within Macro Scheduler pushes the user beyond just macros!

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