How should I add a 5 sec delay between for loop iterations?

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.

1 Like

@Earn_Money_online thanks for replying! I’m sorry but I am unable to understand clearly - can you please elaborate a little bit? Thanks again!

see my answer here


1 Like

Hi, @Taifun! Thanks for replying.

The irony is the idea of adding a delay in my sms-sending loop came after I saw your post :sweat_smile: 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! :slight_smile:

  1. 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

  2. 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

  3. When button click
    Set global X to 1
    Call procedure with get Y to get global X
    Call clock timer enabled to true.

  4. 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
1 Like

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.