You can use the utilities.Timer inside the loop to wait for the seconds specified. For example, uilities.Timer(1) will wait for a second.
I also will recommend to use the utilities.DoEvents inside the loop to process any pending messages in the Windows application message queue. Its also a good idea not to run the loop indefinitely, have some sort of exit strategery. For example, exit the loop after some number of attempts.
See the Formativ language guide for more information about the Utilities object and its properties.
Hope this helps.