How to?

Technical support and scripting issues

Moderators: JRL, Dorian (MJT support)

Post Reply
Breezily
Newbie
Posts: 1
Joined: Mon Sep 12, 2016 1:11 am

How to?

Post by Breezily » Mon Sep 12, 2016 1:19 am

Hey everyone im new to all this macroing thing I have been using the image recognition making loops but how can I make a loop and having it run that loop but if another image appears pause the loop and so a sub loop and once that is finished resume the original loop

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

Re: How to?

Post by Marcus Tettmar » Mon Sep 12, 2016 7:34 am

Well here's some pseudocode:

Code: Select all

Let>main_condition=false
While>main_condition=false

FindImagePos ...
If Image Found
  //sub loop 
  While>something=false
    ...
    ...
    ..
    // at some point something will become true and we'll come out of this loop 
    // to continue with main loop
  EndWhile
Endif

EndWhile
I've used While loops here to demonstrate a concept but they could just as easily be Repeat/Until or even Label/Goto - but in the latter case you'd need to jump out of them.

It's hard to give a more precise answer without knowing what you are wanting to do and what form your code takes. But conceptually you can hopefully see in my example above that there is a main loop within which an image is checked for and when found a sub loop then executes until something=true, whereupon the main loop carries on as before.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar

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

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