Numeric value from FindImagePos array

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Zjaii
Newbie
Posts: 11
Joined: Fri Oct 15, 2010 3:48 pm

Numeric value from FindImagePos array

Post by Zjaii » Wed Nov 10, 2010 9:58 pm

Expecting this to move the mouse cursor when the number 1 key is pressed and it does find an image but my message modal is expressing that it doesnt have the variables called numerically.

Code: Select all

//Press the number 1 key to move the mouse to bottom left of target
OnEvent>KEY_DOWN,VK49,0,Locator
Label>Idle_Loop
Wait>0.02
Goto>Idle_Loop

SRT>Locator
FindImagePos>C:\TargetDump.bmp,SCREEN,20,3,XArr,YArr,NumFound

If>NumFound>0
MessageModal>%X_Array_0%,%Y_Array_0%
MessageModal>X_0,Y_0
MessageModal>X_Array_0,Y_Array_0
//MouseMove> %X_Array_0%,%Y_Array_0%
Endif

End>Locator

You would probably have to scab a TargetDump.bmp into relevant directory to proof it.

Thanks in advance.

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

Post by Marcus Tettmar » Wed Nov 10, 2010 10:45 pm

X_Array_0 and Y_Array_0 are not numbers. No such variables exist either.

Look at your FindImagePos line:

FindImagePos>C:\TargetDump.bmp,SCREEN,20,3,XArr,YArr,NumFound

Notice the bits I have bolded. Your arrays are XArr, and YArr. nort X_Array and Y_Array.

So you mean:

MouseMove>XArr_0,YArr_0
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

adroege
Automation Wizard
Posts: 438
Joined: Tue Dec 07, 2004 7:39 pm

Post by adroege » Wed Nov 10, 2010 10:46 pm

Try This:

You were referencing the wrong variable in your IF statement

Code: Select all

FindImagePos>C:\TargetDump.bmp,SCREEN,20,3,XArr,YArr,NumFound

If>NumFound>0
  MessageModal>%XArr_0%,%YArr_0%
  MouseMove>%XArr_0%,%YArr_0%
Endif

Zjaii
Newbie
Posts: 11
Joined: Fri Oct 15, 2010 3:48 pm

Post by Zjaii » Thu Nov 11, 2010 4:00 am

The help file reads:
"X_Array is the name of a variable to store the X coordinates of each match. The first match is stored in X_Array_0, the second in X_Array_1, etc.

Y_Array is the name of a variable to store the Y coordinates of each match. The first match is stored in Y_Array_0, the second in Y_Array_1, etc."


It seemed feasable to expect that was how to call the first value stored by the array but I tend to miss very obvious things sometimes.

Let me see where those suggestions take me first though.

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