So I am just trying to do simple scripting.
Loop
Exit Loop If [$c = 100]
Set Variable [$c; Value:1]
Perform Script ["Import WS Keys 1X"]
Set Variable [$c; Value:$c + 1]
End Loop
Why doesn't the loop end after 100 times?
+1 @michael.hor257k
if you want you loop to have one hundred iterations you should take the set variable statement outside of loop (to be exact the next code will give you 99 iterations):
Set Variable [$c; Value:1]
Loop
Exit Loop If [$c = 100]
Perform Script ["Import WS Keys 1X"]
Set Variable [$c; Value:$c + 1]
End Loop
Set Variable [$c; Value:$c + 1] will set the value of the variable to 1 if it does not exist.Try it this way instead:
Loop
Set Variable [$c; Value:$c + 1]
Exit Loop If [$c > 100]
Perform Script ["Import WS Keys 1X"]
End Loop
What you have now alternates the value of $c from 1 to 2 and back:
Loop
Exit Loop If [$c = 100]
Set Variable [$c; Value:1]
# THE VALUE OF $c IS 1
Perform Script ["Import WS Keys 1X"]
Set Variable [$c; Value:$c + 1]
# THE VALUE OF $c IS 2
End Loop
Set Variable [$c; Value:1]inside your loop. Wouldn't that reset$cback to1each time?