Could someone pls show me how to write loops?

Hints, tips and tricks for newbies

Moderators: Dorian (MJT support), JRL

Post Reply
Alpha_AI
Pro Scripter
Posts: 61
Joined: Wed Sep 19, 2007 9:30 am

Could someone pls show me how to write loops?

Post by Alpha_AI » Fri Sep 21, 2007 7:19 am

Could someone pls show me how to write loops?
as im looking to PRESS down 13 times.

and also where can i find some documentation on the if statements.

Many thanks,

Ben

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

Post by Marcus Tettmar » Fri Sep 21, 2007 7:36 am

You can just do this:

Press Down * 13

But if that's too fast and you want a pause between each one (and by way of demonstrating a Repeat/Until loop):

Code: Select all

Let>k=0
Repeat>k
  Press Down
  Wait>0.5
  Let>k=k+1
Until>k=13
The really simple way to make a loop is just use a Label and a Goto. This is an infinite loop:

Label>start
..
.. do something
..
Goto>start

With a variable kounter and an If statement it can be made finite. But a Repeat/Until is nicer.

You'll find documentation on the If statements in the help file. Hit F1. In the Command Reference section under Conditional Commands you will find a topic on "If".

Or just type If> in the editor and hit F1 while on that line.
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