Hi, I am looking for a way to add a 5 second delay within my for loop’s iterations - I first searched for a way to do this in here, and I found that the clock component can be used to do this - but I do not know how should I use it so it adds a 5 second delay after each iteration…
Here’s what my loop looks like, it’s job is to send sms messages directly to a bunch of numbers I have in a csv list.
What should I do if I want to add a 5 second delay after every loop iteration? So that my for loop sends messages every 5 seconds? Please guide… Thanks!
use clock component of 5 sec and in it use for each block.and clock should be fire untill and unless the current item does not reach to length of the list.
The irony is the idea of adding a delay in my sms-sending loop came after I saw your post I saw it earlier today, and then I thought I should add a delay in my loop.
My only confusion is how do I use the clock component to create a delay between each iteration, so I do not end up overwhelming the texting component, as you say in your post. Can you please guide me on how do I use the clock component for my app? Thanks a lot!
Initialise on global variable( say X) with zero
and in clock designer part untick timer always fire and timer enabled, also add the milli value as 5000
Create one procedure with one variable say Y
a. Set texting phonenumber to select list item list (global phone numbner) index get Y
b. Set texting message to… (Use same block but in index place use again get Y)
c. Send message direct
When button click
Set global X to 1
Call procedure with get Y to get global X
Call clock timer enabled to true.
When clock timer
If get global X less than or equal to length of the list get global phone number
Then get X to get X + 1
Call procedure get Y to get X
Else set clock timer enabled to false
Call notifier to alert SUCCESS! ALL MESSAGES HAS BEEN SENT