Re: MsAgent SDK

Tech-Archive recommends: Fix windows errors by optimizing your registry

From: William DePalo [MVP VC++] (willd.no.spam_at_mvps.org)
Date: 03/24/04

  • Next message: Matthias Kientz: "question marks in formatted strings"
    Date: Tue, 23 Mar 2004 20:01:22 -0500
    
    

    "a.m.a" <amarcaurele@videotron.ca> wrote in message
    news:1j08c.60001$9p2.1133722@weber.videotron.net...
    > How can you get a MSAgent to tell the time ?

    Have you taken a look at the sample on this page which is a variant of the
    famous "Hello, World" program?

    http://www.microsoft.com/msagent/dev/code/vstudio.asp#VC

    You should be able to add periodic calls to GetLocalTime() and
    GetTimeFormat() or asctime() and pass the result to the agent's speak
    method.

    While it is not the subject of this group, the quick hack below uses JScript
    to access an agent object hosted by a page in IE.

    Regards,
    Will

    <html>
    <head>

    <script language="JavaScript">

    function LoadAgent()
    {
     var agt, genie, date, str;

     agt = document.all.Agent;

     agt.Characters.Load("Merlin", "merlin.acs");

     genie = agt.Characters("Merlin");
     genie.Show();

     date = new Date();
     str = date.toString();

     document.all.time.innerText = str;

     genie.Speak(str);
     genie.Hide();

    // agt.Characters.Unload("Merlin");

    }

    </script>

    <object classid="clsid:D45FD31B-5C6E-11D1-9EC1-00C04FD7081F"
                id=Agent codebase = "#VERSION=2,0,0,0">
    </object>

    </head>

    <body onload="LoadAgent();">
    <P id="time"></P>
    </body>

    </html>


  • Next message: Matthias Kientz: "question marks in formatted strings"