1

I am creating an extreme and kinda silly demo for a presentation I am giving. I was hoping to use some type of API to display multiple actors and was planning on using Microsoft Agent. Is it possible with Microsoft agent to display 2 or more agents at the same time? Using multiple threads or processes is not a problem and it by no means has to be pretty.

To make working with COM easy I am using PowerShell V2 and my current code looks something like this:

$agent = new-object -com agent.control.2
$agent2 = new-object -com agent.control.2

$agent.connected = 1
$agent2.connected = 1
[void] $agent.characters.load("Merlin")
[void] $agent2.characters.load("Robby")
$merlin = $agent.characters.character("Merlin")
$robby = $agent2.characters.character("Robby")

# Insert silly demo with our actors Merlin and Robby here!

EDIT: I am by no means sold on Microsoft Agent. If you have a better way of doing the same or similar thing I would love to hear about it.

JasonMArcher
  • 14,195
  • 22
  • 56
  • 52
smaclell
  • 4,568
  • 7
  • 41
  • 49

2 Answers2

1

Yes, you can load and display multiple characters with a single instance of the MSAgent control. You already have the code needed to do that, simply get rid of $agent2 and replace it with $agent.

$agent = new-object -com agent.control.2

$agent.connected = 1
[void] $agent.characters.load("Merlin")
[void] $agent.characters.load("Robby")
$merlin = $agent.characters.character("Merlin")
$robby = $agent.characters.character("Robby")

You can have multiple characters interact with each other. Microsoft provides code demos to show that in action.

For example:

$merlin = $agent.characters.character("Merlin")
$robby = $agent.characters.character("Robby")
[void] $merlin.Show()
$req = $merlin.Speak("Robby, where are you?")
[void] $robby.Wait($req)
$req = $robby.Show()
[void] $merlin.Wait($req)
$req = $merlin.Speak("Oh, there you are! How are you today?")
[void] $robby.Wait($req)
[void] $robby.Speak("I am good. Thank you for asking")
Remy Lebeau
  • 555,201
  • 31
  • 458
  • 770
1

In the end I used a single agent for my demo and it still got the point across. The final demo was a microsoft agent and the .NET speech api reciting a portion of Romeo and Juliet. I believe that it is possible to get more than one if you use process isolation but then you would need to perform process synchronization.

smaclell
  • 4,568
  • 7
  • 41
  • 49