Making a loop wait until a certain email has received

In my program, I have a for each Excel row activity, but one of the values that needs to be filled in requires an email to be received that may not be in the inbox at the time I have the for each email activity. The only way I have thought to do it is to have a repeat number of times loop with 500 as the value so it keeps checking the email for new unread mail from a certain sender. I then have problems with getting it to exit the loop. Is there any way for it to wait until it has received an email until moving to the next excel row? I used a for each email, but it should be only one at a time since I have them being marked as read. The issue is that if the email isn’t there yet at the time it checks the for each email, it will move on without waiting for the email to come in. Thanks.

Hi @LeoG

Have a look on the thread


Thank you. I understand this and know I could have a separate program running to check the email, but I need it to wait to move on to the next excel row until the email is received. Is there some sort of “until” loop where it will loop until an action is True/False or some type of Boolean operator?

That’s what a While or Do While is. It repeats until the condition is false.

The difference between them is that While checks the condition then executes its activities - so if the condition is false from the beginning the While does nothing. Do While executes its activities then checks the condition to see if it should do them again.

In StudioX, I don’t have a Do While in the activities list. Do you know why that might be? Thanks.

Sorry, I didn’t realize you’re in StudioX. Maybe this will help…

I tried the loop with the check email inside and an if statement to exit the loop, but it does not work for whatever reason… do you have any other suggestions? Thanks.

I think I may have fixed it by changing the number of emails it is checking and changing the condition in the if statement. Thank you for your help.

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