Click to See Complete Forum and Search --> : how to know when Agent is done with speaking
Lothar Haensler
March 1st, 2000, 08:08 AM
I am trying to create a selfrunning demo using the MS agent control. I use the Peedy character from the MS site.
the demo consists of:
1. speak a few sentences
2. display a picture
in a loop
how can I find out when the agent is done speaking?
I didn't find an event and RequestComplete is not fired for the Speak method.
My current problem is that the spoken words and the display of the pictures are out of sync.
Chris Eastwood
March 1st, 2000, 08:18 AM
I've just been looking at this on the web !
Our 'sister'/'parent' site (developer.com) has a 3 part tutorial on developing with the Agents (mainly for websites though). The third part of the tutorial is here :
http://www.developer.com/journal/techworkshop/012600_agents3.html
- I posted the link to the third part as it has links to other sites that provide information for developing with the agents.
I've never used them, although they look kind of cool (but sooo annoying in programs like Outlook etc).
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
Kyle Burns
March 1st, 2000, 08:27 AM
When the character completes your speak request, does the server place it in an idle status? If so, IdleStart would fire. I'm not real experienced with MSAgent, but it's a thought...
Lothar Haensler
March 2nd, 2000, 01:41 AM
That link is exactly where I started my experiments with.
If I had only read it to the end...
Where did I leave my brain?
Thanks.
Chris Eastwood
March 2nd, 2000, 03:17 AM
>Where did I leave my brain?
:)
Any chance that you want to post a small sample program demonstrating the use of Agents to the site ? (If you have the time of course).
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
Lothar Haensler
March 2nd, 2000, 03:22 AM
>Any chance that you want to post a small sample program demonstrating the use of Agents to the site ? (If you have the time of course).
my "program" is a VBScript that runs inside an HTML page. In a loop it loads images and the Agent comments the pictures (all text in German).
If you are still interested, let me know and I'll post it here.
Chris Eastwood
March 2nd, 2000, 03:32 AM
I'd be interested to see it up and running.
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
Lothar Haensler
March 2nd, 2000, 04:44 AM
>I'd be interested to see it up and running.
"up and running"? You mean from the web?
Sorry, it's an Intranet application.
Chris Eastwood
March 2nd, 2000, 04:51 AM
I meant to see the code (and hopefully download something) - There's been a lot of buzz about using the Agents on web-pages / programs etc, but I've yet to see one (apart from those in office).
It would be good to see how easy they are to incorporate into an IntraNet application.
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
Lothar Haensler
March 2nd, 2000, 06:06 AM
here is a sample (I have removed the German text).
...and commented the sourcecode a bit.
<html>
the forum software seems to remove object tags from the post.
Thus I have removed the opening "<" and closing ">". You have to add these around the object tag
create an Instance of the Agent control character
object ID="Agent" Width="0" Height="0"
ClassID="CLSID:D45FD31B-5C6E-11D1-9EC1-00C04FD7081F"
CodeBase="#VERSION=2,0,0,0"
</object>
<body>
<img id="bild" src="demo.bmp">
</body>
<script language="VBSCript">
Dim Peedy
Dim LoadRequestUNC
Dim LoadRequestURL
Dim GetShowAnimation
' this array holds all data for the demo
' index 0: the text to be displayed and "spoken" by peedy
' index 1: the URL of the image
' index 2: the number of milliseconds to wait
dim daten(10, 2)
' index of current entry in array
dim iCurrent
dim peedyLoaded
sub window_onload
call LoadCharacter
peedyloaded = true
dim i
i = 0
' fill the array
daten(i,0) = "first text"
daten(i,1) = "dm1qsweb.bmp"
daten(i,2) = 13000
i = i + 1
daten(i,0) = "text sample
daten(i,1) = "dm2tools.bmp"
daten(i,2) = 13000
i = i + 1
daten(i,0) = "..."
daten(i,1) = "dm3dbueb.bmp"
daten(i,2) = 13000
i = i + 1
daten(i,0) = "..."
daten(i,1) = "dm4server.bmp"
daten(i,2) = 13000
i = i + 1
daten(i,0) = "..."
daten(i,1) = "dm5db.bmp"
daten(i,2) = 13000
i = i + 1
daten(i,0) = "..."
daten(i,1) = "dm6sp.bmp"
daten(i,2) = 13000
i = i + 1
daten(i,0) = "..."
daten(i,1) = "dm7spsel.bmp"
daten(i,2) = 13000
i = i + 1
daten(i,0) = "..."
daten(i,1) = "dm8avoadd.bmp"
daten(i,2) = 13000
i = i + 1
daten(i,0) = "..."
daten(i,1) = "dm9avofrei.bmp"
daten(i,2) = 20000
iCurrent = 0
' start the demo
call window.settimeout("call begindemo", 20000)
end sub
sub begindemo
' load the first image of the demo
document.all.bild.src = daten(iCurrent,1)
end sub
sub nextpicture
' this sub loads the next picture in the demo
iCurrent = iCurrent + 1
if icurrent > 10 or daten(iCurrent,0 ) = "" then
msgbox "demo is finished"
window.close
exit sub
end if
document.all.bild.src = daten(iCurrent, 1)
end sub
sub bild_onload
' picture has been loaded, now do the speaking
if not peedyloaded then
exit sub
end if
peedy.speak daten(iCurrent, 0 )
' wait and display next picture
call window.settimeout("call nextpicture", daten(iCurrent, 2) )
end sub
Sub LoadCharacter
' adopted from MS sample for Peedy
On Error Resume Next
Agent.connected = True
' Attempt to load the character from the Microsoft Agent Chars directory
Set LoadRequestUNC = Agent.Characters.Load ("Peedy", "pathtoACSFile\Peedy.acs")
' If it fails...
If LoadRequestUNC.Status <> 0 Then
' Attempt to load the character from the Microsoft Agent site
'msgbox "konnte peedy nicht laden"
set LoadRequestURL = Agent.Characters.Load ("Peedy", "URLtoACFfile/peedy.acf")
' It didn't fail so assign Peedy to loaded character file
Else
' Assign Peedy to the loaded character
Set Peedy = Agent.Characters("Peedy")
DoIntro
End If
End Sub
Sub DoIntro
' Set the character's language ID
Peedy.LanguageID = &H0409
' Make the character appear
On Error Resume Next
'Peedy.MoveTo window.event.screenX-window.event.clientX+400,window.event.screenY-window.event.clientY+50
Peedy.MoveTo screen.width - 200,window.event.screenY-window.event.clientY+50
Peedy.Show
' Start the monologue
Peedy.Play "Greet"
peedy.play "blink"
Peedy.speak "Hi! I will guide you through the demo"
peedy.play "Restpose"
Peedy.Play "Pleased"
peedy.play "Blink"
End Sub
</script>
</html>
what it does:
the images and text are stored in an array.
in a loop all images are loaded and the text is spoken by the agent character.
Chris Eastwood
March 2nd, 2000, 07:35 AM
Looks good - I was thinking of using an agent in a sample HTA application - I take it that they should still work with one of these ?
Chris Eastwood
CodeGuru - the website for developers
http://codeguru.developer.com/vb
Lothar Haensler
March 2nd, 2000, 07:47 AM
>I was thinking of using an agent in a sample HTA application - I take it that they should still work with one of these ?
I just saved the sample with the extension ".HTA" and of course it worked without any other modifications.
Kyle Burns
March 2nd, 2000, 07:53 AM
Has anyone actually seen MSAgent working on a web page? I'm using IE 5.01 and have been trying to find web sites that use the agent control. Every page (including M$ sample page) has been unable to successfuly load and use the agent.
Lothar Haensler
March 2nd, 2000, 07:55 AM
same with me. I tried almost all the sample sites that Chris mentioned. No luck.
I would NEVER use an Agent control on an Internet site.
codeguru.com
Copyright Internet.com Inc., All Rights Reserved.