Increment arrays in findimagepos

Technical support and scripting issues

Moderators: Dorian (MJT support), JRL

Post Reply
dglancy
Newbie
Posts: 12
Joined: Mon Aug 09, 2004 4:39 pm

Increment arrays in findimagepos

Post by dglancy » Tue Mar 20, 2007 5:38 pm

how do I properly increment the X & Y arrays in the script below?


FindImagePos>Check_button.bmp,mypic.bmp,20,1,X_array,Y_array,imgs
If>imgs>0
let>j=0
repeat>j
Let>xx=%X_array_j%+x
Let>yy=%Y_array_j%+y
MouseMove>xx,yy
LClick
add>j,1
Until>j>imgs
Endif

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

Post by Marcus Tettmar » Tue Mar 20, 2007 6:12 pm

Just use the loop counter:

Code: Select all

FindImagePos>Check_button.bmp,mypic.bmp,20,1,X_array,Y_array,imgs
If>imgs>0
  let>j=0
  repeat>j
    Let>xx=X_array_%j%
    Let>yy=Y_array_%j%
    MouseMove>xx,yy
    LClick
    add>j,1
  Until>j=imgs
Endif
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
Captive
Macro Veteran
Posts: 213
Joined: Sun Oct 20, 2002 8:37 pm
Location: Colorado, USA

Post by Captive » Tue Mar 20, 2007 6:15 pm

Yep you're so close! :]

Let>xx=X_array_%j%
Let>yy=Y_array_%j%
MouseMove>%xx%,%yy%

Also - you might want to change your Until to say;
Until>j=imgs

(when imgs=4, the largest x is X_array_3)

However, the above doesn't work when Let>VAREXPLICIT=1 ... (so maybe Marcus can re-explain how to do that one. :] )

[Edit: Magic, Marcus posted the same info 3 minutes before I did!]

dglancy
Newbie
Posts: 12
Joined: Mon Aug 09, 2004 4:39 pm

Post by dglancy » Tue Mar 20, 2007 8:13 pm

Works like a charm.

thank you both.

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