Contents Previous Next Subchapters

Determining if O-Matrix is Busy
Syntax status = OMServer.IsBusy()
See Also open

This function can be used in COM clients to determine if O-Matrix is available or if it is still busy processing previous requests. The returned value status is an integer that will equal 1 if O-Matrix is busy, and 0 otherwise.

The following Visual Basic script illustrates the usage of the IsBusy method by performing a long-running O-Matrix calculation and then calling IsBusy until the calculation has completed. This script is available in the COM\scripts directory of the O-Matrix distribution.

' IsBusy.vbs
' This example illustrates usage of the .IsBusy() O-Matrix COM server method
'    usage: cscript IsBusy.vbs
' O-Matrix must be running before running this script
' Instantiate the O-Matrix COM Server
set OM =CreateObject("OMatrixServer.OMServer")
status = OM.Open
If status <> 1 Then
     WScript.Echo("Error connecting to O-Matrix")
End If
If status = 1 Then
     status = OM.Eval("clear")
     WScript.Echo("Execute a long-running command in O-Matrix...") 
     status = OM.Eval("for i=1 to 100 begin print i; x=rand(2000,2000); end")

     ' Query O-Matrix with IsBusy() until it is not busy
     status = OM.IsBusy()
     WScript.Echo("OM.IsBusy() == " & status)
     Do While status = 1
          status = OM.IsBusy()
          WScript.Echo("OM.IsBusy() == " & status)
     WScript.Echo("OM.Eval complete")
End If

MsgBox("IsBusy.vbs VBScript Complete")