Wilson WindowWare Tech Support

WinBatch WinBatch+Compiler WebBatch
Home | Tech Database | Tech BBS | White Papers | Purchase


Microsoft Agent Example.wbt

Keywords: 	  microsoft agent example.wbt

;********************************************************************************
; Microsoft Agent Example
;
; Requires Micrsoft Agent, L&H TrueVoice, and the Merlin character
; Available from http://msdn.microsoft.com/workshop/imedia/agent/agentdl.asp
;********************************************************************************

; Create an instance of the control 
MyAgent = ObjectOpen("Agent.Control.2")

MyAgent.Connected = @TRUE

Characters = MyAgent.Characters

; Load the character
 Characters.Load("Merlin", "Merlin.acs")

 Merlin = Characters.Character("Merlin")

; Display the character
Merlin.Show
Merlin.Speak("Hello all.")
Merlin.Speak("I am Merlin.")
Merlin.MoveTo(340,240)
;Note the use of single quotes so you can use double quotes in the map command
;The map command has 2 parameters.  The first is how you want the text pronounced.
;The second is how you want it shown in the balloon
Merlin.Speak('Using agent within \Map="Win Batch"="WinBatch"\ is not that difficult.')
Merlin.Speak("Since you are running a OLE object,")
Merlin.Speak('In order to sync \Map="Win Batch"="WinBatch"\ commands with things happening in agent,')
Merlin.Speak("You loop until the 'status' of a command is complete.")
Merlin.MoveTo(620,460)
GestureRight = Merlin.Play("GestureRight")
While @TRUE
   If GestureRight.Status == 0 then break ;if gesture command has succesfully completed
EndWhile
Run("notepad","")
TimeDelay(3)
SendKey("This is a notepad example.{ENTER}")
Merlin.Play("RestPose")
Merlin.Speak("Now I'll close notepad, choosing not to save the file")
TimeDelay(5)
SendKey("!fx")
TimeDelay(1)
SendKey("n")

AgentDone = Merlin.Speak("Thus ends this agent example.")

While @true
   If AgentDone.Status == 0 
      TimeDelay(1)
      Merlin.Hide
      TimeDelay(3)
      Exit
   EndIf
   TimeDelay(1)
EndWhile






Article ID:   W14955