ZennoLab

Automate everything

User Tools

Site Tools


en:looping

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revision Previous revision
en:looping [2015/07/14 15:51]
127.0.0.1 external edit
en:looping [2015/08/13 16:18] (current)
vladz
Line 7: Line 7:
  
  
-====== If you know exactly how many times an action should be repeated =====+===== If you know exactly how many times an action should be repeated =====
  
 Firstly you have to create variable by **Variable processing - Set value** action. When initializing a counter you indicate its initial value and a name, by which to later distinguish it, get it and increase it (its value). Inside the loop you need to increase your counter value once and then you should wait until it surpasses the required value - this will be a signal to exit the loop. Otherwise you return to the start of the loop. When comparing the counter and the value you do not have to put in brackets either the value or the counter macro as you are basically comparing values and not texts. Firstly you have to create variable by **Variable processing - Set value** action. When initializing a counter you indicate its initial value and a name, by which to later distinguish it, get it and increase it (its value). Inside the loop you need to increase your counter value once and then you should wait until it surpasses the required value - this will be a signal to exit the loop. Otherwise you return to the start of the loop. When comparing the counter and the value you do not have to put in brackets either the value or the counter macro as you are basically comparing values and not texts.
-====== Exiting the loop following an event on the web page ====== 
  
 +===== Exiting the loop following an event on the web page =====
  
 This event could be appearance of a specific text on the web page or a jump to the required URL - in any case you will need to use **Logic - If** action in which you will write the criterion for exiting the loop using JavaScript. Please be reminded that exit with error (through the red point) from this action occurs when your JavaScript generates false at execution. You don't need to learn JavaScript. Just look at screenshots and change data to fit your needs. This event could be appearance of a specific text on the web page or a jump to the required URL - in any case you will need to use **Logic - If** action in which you will write the criterion for exiting the loop using JavaScript. Please be reminded that exit with error (through the red point) from this action occurs when your JavaScript generates false at execution. You don't need to learn JavaScript. Just look at screenshots and change data to fit your needs.
-====== Exiting the loop following an error ====== 
  
 +===== Exiting the loop following an error =====
  
 It's the easiest scenario, when you don't know how many times the loop will run and what will be the condition of its end, however you do know that at some point in a project an execution error will occur and the loop will be disrupted. For instance, when parsing search engines you press the Next button in your loop, it's obvious that soon you will get to the last page and this button will disappear and the loop will end in error. An error in this example does not mean that something will go wrong, it is simply an exit from the project in case of branch execution errors and in this particular case this error helps us exit the loop.\\ ​ It's the easiest scenario, when you don't know how many times the loop will run and what will be the condition of its end, however you do know that at some point in a project an execution error will occur and the loop will be disrupted. For instance, when parsing search engines you press the Next button in your loop, it's obvious that soon you will get to the last page and this button will disappear and the loop will end in error. An error in this example does not mean that something will go wrong, it is simply an exit from the project in case of branch execution errors and in this particular case this error helps us exit the loop.\\ ​
Line 23: Line 22:
 {{:​en:​cycle1_eng.png?​200}}{{:​en:​cycle2_eng.png?​200}}{{:​en:​cycle3_eng.png?​200}} {{:​en:​cycle1_eng.png?​200}}{{:​en:​cycle2_eng.png?​200}}{{:​en:​cycle3_eng.png?​200}}
  
-====== Variable counter ======+===== Variable counter ===== 
 {{youtube>​gtkflXeyMG0?​medium}} {{youtube>​gtkflXeyMG0?​medium}}
  
-====== If-logic action ======+===== If-logic action ===== 
 {{youtube>​2gkQl_iahhc?​medium}} {{youtube>​2gkQl_iahhc?​medium}}
  
-====== How to create a basic loop ======+===== How to create a basic loop ===== 
 {{youtube>​eaAURblV2Mw?​medium}} {{youtube>​eaAURblV2Mw?​medium}}
en/looping.txt · Last modified: 2015/08/13 16:18 by vladz