Share via


Generic Callback Procedures

The WMS Active Script Event Handler plug-in responds to event notices raised by the server by calling the appropriate callback in a script file that you create. Your script can implement the following generic callback procedures.

Function prototype

Description

OnWMSPluginInitialize (ServerCtx)

The server calls this procedure to initialize the WMS Active Script Event Handler.

OnWMSPluginHeartbeat ( )

The server calls this procedure at each heartbeat interval. You can define a heartbeat in your script by declaring a global variable called WMSHeartbeat and setting it to the desired heartbeat in milliseconds (ms). WMSHeartbeat must be greater than 100 ms. Because this is a low-priority event, the function call is not guaranteed to occur at the exact interval specified.

OnWMSPluginShutdown ( )

The server calls this procedure to shut down the WMS Active Script Event Handler plug-in.

The following Visual BasicĀ® Scripting Edition (VBScript) example illustrates how to create a prototype for each of the generic callback procedures.

VBScript Example

Dim WMSHeartbeat
' Set the interval to 10 seconds.
WMSHeartbeat = 10000

Dim MyFile

Sub CreateAfile
  Dim fso
  Set fso = CreateObject("Scripting.FileSystemObject")
  Set MyFile = fso.CreateTextFile("c:\wmpub\wmroot\testfile.txt", True)
End Sub

Sub TraceInformation( strTraceText )
    MyFile.WriteLine( strTraceText )
    MyFile.WriteLine
End Sub


Sub OnWMSPluginInitialize ( ServerCtx )
    CreateAfile
    tempStr = "OnWMSPluginInitialize " & Now
    TraceInformation( tempStr )
End sub

Sub OnWMSPluginHeartbeat ()
    tempStr = "OnWMSPluginHeartbeat " & Now
    TraceInformation( tempStr )
End sub

Sub OnWMSPluginShutdown ()
    tempStr = "OnWMSPluginShutdown " & Now
    TraceInformation( tempStr )
    MyFile.Close
End sub

See Also

Concepts

WMS Active Script Event Handler Plug-in Properties