Sunday, June 04, 2006

Sleep function in LotusScript

If you want to pause script execution in LotusScript, yuo can use Sleep function. You might want to do it if you need to wait until external operation completes.

Syntax:
Sleep n

Where n is a number of seconds.

If you want to pause for less than 1 second, use following:
Sleep 0.2 ' pause for 200ms

Another good function to use in conjunction with Sleep is DoEvents. Using DoEvents in code allows you to stop looping code with Ctrl+Break keyboard command. Without it Notes client is often not responsible to break command.
Documentation says that Doevents and Yield functions are same, but in my experience DoEvents works much better... at least in older versions of Notes.

Call MyObject.SendExternalMessageDLL("message")
While Not MyObject.Status=2
sleep 0.1
DoEvents
Wend

No comments: