How to pause the script until a condition is met and re-initiate the script?

Good day,

Firstly I’d like to say how amazing this program is. So easy to use and the use cases are endless in business.

I am however sitting with a bit of a problem.

I’m running a script that checks if a certain folder is empty (where the folder receives pushed files continuously) . If the folder is not empty the script runs (via a while loop (while list variable is not empty) embedded in an if statement).

The functions within the while loop is as follow:
Takes the files from folder checked to another folder, copies values into standard excel, saves values into virtual memory, constructs email and send email (with certain parameters), checks again if the original folder is empty or not. If the folder is not empty the while loop repeats. If the folder is empty though, the process ends.

Now what I want to happen instead of ending, is the script should enable RPA Express to wait and do regular checks if the folder is still empty until the folder is not empty anymore, then start the while loop again.

I hope someone can help :slightly_smiling_face:

Kind regards
Johan

@johan.devilliers try this:

add another ‘While’ loop after reading the folder in the loop (let’s say you save it to variable ${files}) with the following condition:

While ${files} is empty:

  • wait for a certain period
  • get folder contents in variable ${file}

Once there are files in the folder, the bot should exit the second loop and start executing the actions in the first loop (while ${files} is not empty)

Thank you very much @ashapkina.

This works perfectly!

Kind regards
Johan

1 Like