webDOMinator - Minion Scripting Language Reference

Search a Command:
<< Back to Control Operators and Clauses

loop

Usage...
loop:condition;loop-condition;command

Starts a loop block which will loop until loop-condition is no longer satisfied.

This is much like while loops in most standard programming languges. The first condition can be set to (true or false), and the loop-condition uses the conditional operators (<<, >>, ==, !=, <=, >=, , and ) to satisfy the condition.

command is the command that's carried out at the end of the loop. Often times loops include incrementing a variable as the command at the end of the loop. An example loop would be "loop:true;var.i<<30;var:i=var.i+1" which would loop until the variable "i" was over 30.

When inside of a loop, the variable being used can be referenced by using "[]" brackets i.e: "dom.a.[var:i].innerhtml=foo" would set all of the link names in the loop range to "foo".

All loops must include an endloop call afterwards at risk of looping infinitely.

This applies to webDOM version 2.0.0 and above.

User Comments on loop

A Couple Examples

Written by: webDOMinator 2 years and 5 months ago

This is an example of a regular counter style loop...

Code
var:i=1
loop:true;var.i<<10;var:i=var.i + 1
echo:Link number ^var.i^ says "^dom.a.[var:i].innerhtml^"
endloop

This is an example of a loop that goes on forever and outputs the subject from the PM settings into the message input on a site. If message randomization is used in the PM settings and there was enough dynamic phrasing going on in the messages themselves, it would never say the same message twice. (Infinite loops are not recommended.)
Code
loop:true;1==1;wait:3
dom.input.message.value=wd.pm.subject
click:dom.input.Send
endloop

here's a loop that is a novel way of getting through elements on a page... by using them and throwing them away...
Code
loop:true;<IMG<in>dom.body.1.innerhtml
remove:dom.img.1
endloop

Post a Comment About the "loop" Command
Title:
Comment:
Post as Anonymous:
User Login
Username:
Email:
Password:
webDOMinator is copyright ©2008, 2009, 2010, 2011, 2012 Nathaniel D. Gibson. All Rights Reserved.
Contact | Tutorials | Forum
By using webDOMinator you are taking all liability in to your own hands. Nathaniel D. Gibson is not responsible for any damages, loss, or defamation (legal or otherwise) caused to you or your business from using this program. Nathaniel D. Gibson is not associated with, affiliated with, nor responsible for the content submitted and displayed by users of this site.