Script to launch on client with click event

Discussion in 'ASP .Net' started by pmclinn@gmail.com, Apr 11, 2005.

  1. Guest

    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>
     
    , Apr 11, 2005
    #1
    1. Advertising

  2. Guest

    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>
     
    , Apr 11, 2005
    #2
    1. Advertising

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

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Purvi T
    Replies:
    0
    Views:
    880
    Purvi T
    Oct 19, 2004
  2. Steven Spits
    Replies:
    6
    Views:
    4,502
    z. f.
    Jun 22, 2004
  3. Chu
    Replies:
    2
    Views:
    913
    Winista
    Apr 10, 2006
  4. Max2006
    Replies:
    2
    Views:
    1,593
    Walter Wang [MSFT]
    Sep 19, 2007
  5. Steven Spits

    running client side script after an <asp:ButtonColumn> click event

    Steven Spits, Jun 22, 2004, in forum: ASP .Net Datagrid Control
    Replies:
    6
    Views:
    207
    z. f.
    Jun 22, 2004
Loading...

Share This Page