I'm working on some KIX scripting and would like to incorporate the Microsoft agent. Somewhere (I can't remember exactly) I found some sample code for using an MS Agent in KIX. A shortened verion of a sample is this:$AgentName="Genie"
$AgentPath = "%WinDir%\MSAgent\Chars\Genie.ACS"
$Agent = CreateObject ("Agent.Control.2")
If @Error = 0
$Agent.Connected = "1"
$agent.raiserequesterrors="True"
$=$Agent.Characters.Load($AgentName,$AgentPath)
$Char = $Agent.Characters.Character($AgentName)
$=$Char.Show()
$=$Char.MoveTo(400, 300)
$Req=$Char.Speak("Hello. Thank you for logging on to the network")
EndIf
The issue is that the script ends before the character has done anything. I've found that in VBScript you can deal with this by using code like this:
Set Figure1 = Activate("Genie")
Figure1.Show
figure1.MoveTo(300,300)
set Request1=figure1.speak("Welcome to the new network")
Do Until request1.Status = Complete
Wscript.Sleep 100
Loop
Function Activate(Figure)
Path = "%WINDIR%\MSAGENT\CHARS\" & Figure & ".ACS"
Set AgentControl = WScript.CreateObject("Agent.Control.1", "event_")
If IsObject(AgentControl) Then AgentControl.Connected = True
Set wshshell = CreateObject("WScript.Shell")
Path = wshshell.ExpandEnvironmentStrings(Path)
AgentControl.Characters.Load Figure, Path
Set Activate = AgentControl.Characters(Figure)
End Function
The key seems to be these lines:
set Request1=figure1.speak("Welcome to the new network")
Do Until request1.Status = Complete
Wscript.Sleep 100
Loop
How do I emulate this in KIX? I'm pretty comfortable with KIX, and know almost nothing about VBScript but I've never tried working with this type of thing before.
What I've read is that the first statement sets a "REQUEST". The "DO" loop checks the status of the request and will continue to loop until the request finishes. How do I set the request in KIX and how do I check the status?
Thanks in advance.