Jump to content
Macro Express Forums

Repeat until + Repeat Counter


MattM2013

Recommended Posts

To anyone willing to help:

 

I have a loop that reads like this:

 

Repeat Until %T1% = ""

body of function

Repeat End

 

However, I want to insert a counter potentially into a variable within the loop so that when the function is done once, one set of instructions is needed. If the function is done twice then do this, if done three or more times then do this. Anyone know of a way to make it happen?

 

Thanks

Link to comment
Share on other sites

Maybe something like this?

Variable Set Integer %N1% to 0
Repeat Until %T1% Equals ""
// Body of Repeat Loop
  Variable Modify Integer %N1%: Increment
End Repeat
 
// Check the value of %N1%, and decide what to do with it.
Switch( %N1% )
Case: 0
// Do this if %N1% = 0
End Case
 
Case: 1
// Do this if %N1% = 1
End Case
 
Case: 2
// Do this if %N1% = 2
End Case
 
Default Case
// Do this if %N1% = 3 or more
End Case
 
End Switch

Link to comment
Share on other sites

 

Maybe something like this?

Variable Set Integer %N1% to 0
Repeat Until %T1% Equals ""
// Body of Repeat Loop
  Variable Modify Integer %N1%: Increment
End Repeat
 
// Check the value of %N1%, and decide what to do with it.
Switch( %N1% )
Case: 0
// Do this is %N1% = 0
End Case
 
Case: 1
// Do this is %N1% = 1
End Case
 
Case: 2
// Do this is %N1% = 2

End Case
 
Default Case
// Do this is %N1% = 3 or more
End Case
 
End Switch

Thanks Alan!!!! Worked flawlessly!!! But what exactly is the significance of the "Switch" command?

Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

Loading...
×
×
  • Create New...