RequestStart Event

Description

Occurs when the server begins a queued request.

Syntax

Sub agent_RequestStart (ByVal Request)

Value Description
Request Returns the Request object.

Remarks

The event returns a Request object. Because requests are processed asynchronously, you can use this event to determine when the server begins processing a request (such as a Get, Play, or Speak method) and thereby synchronize this with other actions generated by your application. The event is sent only to the client that created the reference to the Request object and only if you defined a global variable for the request reference:

    Dim MyRequest 
    Dim Genie 

    Sub window_Onload
    
    Agent1.Characters.Load "Genie", _
        "http://agent.microsoft.com/characters/genie/genie.acf"    

    Set Genie = Agent1.Characters("Genie")

    ' This syntax will generate RequestStart and RequestComplete events.
    Set MyRequest = Genie.Get("state", "Showing")

    ' This syntax will not generate RequestStart and RequestComplete events.
    Genie.Get ("state", "Hiding")

    End Sub

    Sub Agent1_RequestStart(ByVal Request)

    If Request = MyRequest Then
        Status = "Loading the Showing animation"

    End Sub

The Status returns 4 (request in progress) for the Request object returned.

NoteIn VBScript 1.0, this event fires even if you don't define references to a Request object. This has been fixed in VBScript 2.0, which can be downloaded from http://microsoft.com/msdownload/scripting.htm.

See Also

RequestComplete event

--------------------------------------------------------