Shoutbox

MS Agent - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Skype & Technology (/forumdisplay.php?fid=9)
+---- Forum: Tech Talk (/forumdisplay.php?fid=17)
+----- Thread: MS Agent (/showthread.php?tid=86923)

MS Agent by andrewdodd13 on 10-28-2008 at 12:03 AM

So, I'm just making me a little agent which will sit on top of all my Windows and read my MSN messages (I've disabled TTS, that was annoying! but I like the balloon). It works great, except... the balloon displays each word individually... and that's really annoying.

I got the PropertySheet up (that was a nuisance!) but there doesn't seem to be an option for this, only for disabling the balloon completely. Not what I want obviously.

Anyone know a way for it just to show the full message?
Ta.

PS: For those interested, in VB .NET you can add a reference to the MS Agent Server 2.0 thing, and use this code:

code:
Dim server As AgentServerObjects.AgentServer = New AgentServerObjects.AgentServer
Dim tv As AgentServerObjects.IAgentPropertySheet = server
tv.SetVisible(True)
To show the property pages.

RE: MS Agent by ShawnZ on 10-28-2008 at 03:26 AM

well, what's your code to make it talk?


RE: MS Agent by andrewdodd13 on 10-28-2008 at 03:06 PM

code:
var AgentServer;
var AgentChar;

function OnEvent_Initialize(MessengerStart)
{
    AgentServer = new ActiveXObject("agent.control.2");
    AgentServer.Connected = true;
    AgentServer.Characters.Load("Pikachu","C:\\WINDOWS\\msagent\\chars\\Pikachu.acs");
    AgentChar = AgentServer.Characters.Character("Pikachu");
    AgentChar.Show();
}

function OnEvent_ChatWndReceiveMessage(ChatWnd, Origin, Message, MsgKind) {
    if(Origin != Messenger.MyName)
        AgentChar.Speak(Origin + ": " + Message);   
}

Basically exactly what -dt- posted in the scripting sticky. :)
RE: MS Agent by Spunky on 10-28-2008 at 07:48 PM

quote:
BOOL Speak(CString szSpeakText, BOOL bBalloonEnabled = TRUE, BOOL bBalloonSizeToText = TRUE, BOOL bBalloonAutoPace = TRUE, BOOL bBalloonAutoHide = TRUE);


The specified text is shown in a message box and if a sound card and Text to speech support is installed the given text is spoken out. Setting Auto Pace to FALSE makes the text displayed in the message box appear at once rather than a word at a time.

RE: MS Agent by andrewdodd13 on 10-28-2008 at 11:23 PM

Argh, I didn't even think to look at the documentation for the actual function.

Thanks :)

Edit. So that's not Microsoft's documentation nor their function. So I need to wrap the following:

code:
BOOL CMsAgentWrapper::Speak(CString szSpeakText,BOOL bBalloonEnabled,BOOL bBalloonSizeToText,BOOL bBalloonAutoPace,BOOL bBalloonAutoHide)
{
    if(m_bAgentReady == FALSE)
        return TRUE;
    szSpeakText.TrimLeft();
    szSpeakText.TrimRight();
    if(szSpeakText.IsEmpty())
        return FALSE;
    if(m_pszCurCharID == NULL)
        return FALSE;

    CAgentCtlCharacterEx Character;
    COleVariant vEmpty;
    COleVariant vText;
    CString pszText;
    UINT uBalloonFlags;

    uBalloonFlags = 0;

    Character = m_obAgent.GetCharacters().Character(m_pszCurCharID);

    if (bBalloonEnabled)
        uBalloonFlags |= BALLOON_STYLE_BALLOON_ON;

    if (bBalloonSizeToText)
        uBalloonFlags |= BALLOON_STYLE_SIZETOTEXT;

    if (bBalloonAutoPace)
        uBalloonFlags |= BALLOON_STYLE_AUTOPACE;

    if (bBalloonAutoHide)
        uBalloonFlags |= BALLOON_STYLE_AUTOHIDE;

    Character.GetBalloon().SetStyle((long)uBalloonFlags);

    if (m_bStopBeforePlay)
        Character.StopAll(vEmpty);

    vText = szSpeakText;

    Character.Speak(vText, vEmpty);
    return TRUE;
}
But, I can't seem to call Character.GetBalloon() ! :(

(I would imagine all I need to do is set a certain bit and call Character.GetBalloon().SetStyle(my bits);
But like I said, the function doesn't work.:)
RE: MS Agent by Spunky on 10-29-2008 at 09:40 AM

You may be able to do something with this...

http://www.codeproject.com/KB/tips/msagentctrl.aspx

The only alternative is using msagent.think(), but I'm guessing you want the tts?


RE: MS Agent by andrewdodd13 on 10-29-2008 at 04:17 PM

The link happens to be where I pulled the source code from. :P

think() does the same thing as speak() for some reason.

Guess I could just code an MFC DLL and export it if I really have to.