Elke Bahlinger
2nd October 2008, 12:42
Hi,
can anybody help me in this:
I need to start a function that checks, if a condition is fulfilled. If no, a timer should start who causes the session to stop and wait 5 seconds and start the checking the condition again.
This process should be executed 5 times. If the condition is not fulfilled after the 5 retries, the program needs to be aborded.
Does anybody knows a function how to set a timer in that case?
Thanks in advance,
Elke
bdittmar
2nd October 2008, 14:21
Hi,
can anybody help me in this:
I need to start a function that checks, if a condition is fulfilled. If no, a timer should start who causes the session to stop and wait 5 seconds and start the checking the condition again.
This process should be executed 5 times. If the condition is not fulfilled after the 5 retries, the program needs to be aborded.
Does anybody knows a function how to set a timer in that case?
Thanks in advance,
Elke
Hello,
maybe this helps :
set.timer()
--------------------------------------------------------------------------------
Syntax
long set.timer( long msec )
Description
This starts a timer that sends an EVTTIMEREVENT event to the calling process every msec milliseconds. The timer continues to send events until the process ends or until the program explicitly terminates the timer using kill.timer().
Return values
A unique identifier for the timer.
Note
The kill.timer() function uses the identifiers returned by this function to specify which timer it is terminating.
Context
Bshell function.
Example
tim.id = set.timer(2000)
next.event( event )
on case evt.type( event )
case EVTTIMEREVENT:
if (evt.timer.id(event) = tim.id )
message("My '2000' timer expired")
endif
break
endcase
mark_h
2nd October 2008, 15:57
Or something like this:
cnt=1
rc = seq.open.local(distil.path & strip$(spool.fileout) &".pdf","r",0)
while rc <= 0 and cnt<15
suspend(5000)
cnt = cnt + 1
rc = seq.open.local(distil.path & strip$(spool.fileout) &".pdf","r",0)
seq.close.local(rc)
endwhile
This is waiting for a local file to be created.
george7a
3rd October 2008, 11:04
Hi,
I would go with Mark's suggestion. You need to change the "cnt" variable to instead of 15 and replace the while condition with your own.
I do not like using the timer. However, If you have decided to use it do not forget to kill it in the end.
- George
Elke Bahlinger
6th October 2008, 08:57
Hi all,
thanks for your answeres. I guess the suspend() function is exactly what I need.
Thanks again,
Elke