Notifications
Clear all

[Closed] progressBar and sleep

Hi,

I have this small script where I want to delay the execution of a rendering (with sleep) and I would like to use a progressBar as an indicator for when the rendering actually starts (see script).

iSeconds = 3
		
progressStart "test"

for i = 1 to iSeconds do
(
	format "starting in % sec...
" ( iSeconds - iSecondsWaited )		
	sleep 1
		
	progressUpdate ( i / iSeconds * 100.0 )
)
			
progressEnd()

But it seems that neither the progress bar nor any of the viewports are being updated within the for-loop. If I replace the sleep by something else that takes a little time (like a math. calculation) it works like a charm. It would be nice to have some visual feedback though. Does anybody have an idea what is wrong here ? I am on MAX 9 64 Bit.

2 Replies

It might be worth looking at the timer UI item instead of a for loop with sleep.

cool thanks for the tip ! I have got it working with a timer item… still I am curious why the sleep function seems to not only block i/o while it is running but also while it is not running.