RequestComplete Event

Description

Occurs when the server completes a queued request.

Syntax

Sub agent_RequestComplete (ByVal Request)

Value Description
Request Returns the Request object.

Remarks

This event returns a Request object. Because requests are processed asynchronously, you can use this event to determine when the server completes processing a request (such as a Get, Play, or Speak method) to synchronize this event with other actions generated by your application. The server sends the event 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 = Agent.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_RequestComplete(ByVal Request)

    If Request = MyRequest Then
        Status = "Showing animation is now loaded"

    End Sub

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

RequestStart event

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