Macros and the IBM CognosScript Language  7.5.0
IBM CognosScript Statements and Functions >

DoEvents Statement

Description

Yields execution to Windows for processing operating system events.

Syntax

DoEvents

Comments

DoEvents does not return until Windows has finished processing all events in the queue and all keys sent by SendKeys statement..

DoEvents should not be used if other tasks can interact with the running program in unforeseen ways. Since the IBM CognosScript editor yields control to the operating system at regular intervals, DoEvents should only be used to force the IBM CognosScript editor to allow other applications to run at a known point in the program.

Example

This example activates the Windows Phone Dialer application, dials the number and then allows the operating system to process events.

Sub main
   Dim phonenumber, msgtext
   Dim x
   phonenumber=InputBox("Type telephone number:")
   x=Shell("Dialer.exe",1)
   For i = 1 to 5
      DoEvents
   Next i
   AppActivate "Phone Dialer"
   SendKeys phonenumber & "{Enter}",1
   msgtext="Dialing..."
   MsgBox msgtext
   DoEvents
End Sub

See Also

AppActivate Statement

SendKeys Statement

Shell Function