Script to launch on client with click event

P

pmclinn

The code below is generated by an application that allows you to put a
Microsoft assistant on a webpage. I'm having a heck of a time trying
to get this script to launch on a server side button click though.

I want my user to click on a button to launch this script. I have
tried adding the object code to the html directly and then creating a
client on click event with no luck.

I eventually want to dynamically update the text that will be spoken
but for right now all I need help with is getting a script to work on a
server side button click.

Thanks for any help you can give me....


<HTML>
<HEAD>
<TITLE>My Web Store</TITLE>

<!-- Start of WebSpeak VB Script -->
<!-- This script is created using WebSpeak -->
<!-- Download Free Trial From: -->
<!-- http://www.shadisoft.com/webspeak -->

<OBJECT ID="Agent" width=0 height=0
CLASSID="CLSID:D45FD31B-5C6E-11D1-9EC1-00C04FD7081F"
CODEBASE="#VERSION=2,0,0,0">
</OBJECT>


<OBJECT width=0 height=0
CLASSID="CLSID:B8F2846E-CE36-11D0-AC83-00C04FD97575"
CODEBASE="#VERSION=6,0,0,0">
</OBJECT>


<SCRIPT LANGUAGE="VBScript">
<!--
Dim C
Dim URLReq
Dim ShowAnimReq

Sub Window_OnLoad()
LoadCharacter
End Sub

Sub LoadCharacter()
Dim Req

On Error Resume Next

Set Req = Agent.Characters.Load ("Char", "ROBBY.acs")
If Req.Status <> 0 Then
Set URLReq = Agent.Characters.Load("Char",
"http://agent.microsoft.com/agent2/chars/robby/robby.acf")
Else
Set C = Agent.Characters("Char")
Start
End If
End Sub

Sub Agent_RequestComplete(ByVal Request)
Dim Req

If Request = URLReq Then
If Request.Status = 1 Then
'Something to do if the URl load failed.. Busy server
Exit Sub
ElseIf Request.Status = 0 Then
Set C = Agent.Characters("Char")
Set ShowAnimReq = C.Get("state", "showing, speaking,
hiding")
C.Get "animation", "Surprised,StopListening,MoveUp", False
End If
ElseIf Request = ShowAnimReq Then
If Request.Status = 1 Then
'Request to load the Show animation failed. The server may
be busy.
Exit Sub
ElseIf Request.Status = 0 Then
Start
End If
End If
End Sub

Sub Start()

C.Moveto 800, 0
C.Show
C.Play "Surprised"
C.Speak "\pit=130\\spd=157\Hi, welcome to My Web Store!"
C.Play "StopListening"
C.Speak "\pit=130\\spd=157\Please feel free to browse our huge
selection of computer hardware and software. We offer the best prices
on the web, always!"
C.Speak "\pau=1000\"
C.Speak "\chr=""whisper""\\pit=130\\spd=157\For a limited time, I
will offer you free shipping on any order valued at $50.00 or more.
Hurry, this won't last for ever!"
C.Play "MoveUp"
C.Speak "\pit=130\\spd=157\Good Bye!"
C.Hide

End Sub

-->
</SCRIPT>

<!-- End of WebSpeak VB Script -->

<BODY>

<!-- Add your HTML code here -->

</BODY>
</HTML>
 
P

pmclinn

I was able to get my example to halfway work. I created an html button
that calls on the LoadCharacter sub. However, I have not been able to
update this script dynamically yet. Everytime I try to change this
into a server side script something fails.


<SCRIPT LANGUAGE="VBScript">
<!--
Dim C
Dim URLReq
Dim ShowAnimReq
Sub LoadCharacter()
Dim Req
On Error Resume Next
Set Req = Agent.Characters.Load ("Char", "PEEDY.acs")
If Req.Status <> 0 Then
Set URLReq = Agent.Characters.Load("Char",
"http://agent.microsoft.com/agent2/chars/peedy/peedy.acf")
Else
Set C = Agent.Characters("Char")
Start
End If
End Sub
Sub Agent_RequestComplete(ByVal Request)
Dim Req
If Request = URLReq Then
If Request.Status = 1 Then
'Something to do if the URl load failed.. Busy server
Exit Sub
ElseIf Request.Status = 0 Then
Set C = Agent.Characters("Char")
Set ShowAnimReq = C.Get("state", "showing, speaking,
hiding")
C.Get "animation", "Pleased,Announce,Wave", False
End If
ElseIf Request = ShowAnimReq Then
If Request.Status = 1 Then
'Request to load the Show animation failed. The server may
be busy.
Exit Sub
ElseIf Request.Status = 0 Then
Start
End If
End If
End Sub
Sub Start()
C.Moveto 800, 0
C.Show
C.Play "Pleased"
C.Speak "Hi, welcome to the Eastern Marketing Page!"
C.Play "Announce"
C.Speak "Currently I'm being programmed to summerize the data on
this page!"
C.Speak "\pau=1000\"
C.Speak "\chr=""whisper""\I'm working as fast as I can to finish
this page!"
C.Play "Wave"
C.Speak "Good Bye!"
C.Hide
End Sub
-->
</SCRIPT>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,995
Messages
2,570,233
Members
46,821
Latest member
AleidaSchi

Latest Threads

Top