What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » account name in taskbar (msn polygamy)

account name in taskbar (msn polygamy)
Author: Message:
lespoils
New Member
*


Posts: 4
40 / Male / Flag
Joined: Nov 2008
O.P. account name in taskbar (msn polygamy)
hi,

first of all i'm very new to the scripting and all.

my question is fairly simple. i'm presently using multiple accounts with messenger. and i have the following poblem.

when someone talks to either active accounts, the message flashes in the taskbar (as it normaly does, and that is fine). My problem is i wish i could know to whom (wich account active account) the message is meant before clicking on it.

so here's what i had in mind. Since the text u see in the taskbar seems to be the title of the chat window (hence the contact name) i was wondering if it is possible to add the msn name of the account.

so lets say my name is "lespoils" and my friend name is "crofteur", the flashing taskbar would show something like :
Lespoils : crofteur

so any information on how to do and where to start is very welcomed

Thx

Lespoils
11-28-2008 08:31 PM
Profile PM Find Quote Report
roflmao456
Skinning Contest Winner
****

Avatar

Posts: 955
Reputation: 24
30 / Male / Flag
Joined: Nov 2006
Status: Away
RE: account name in taskbar (msn polygamy)
you can try out the "SetWindowText" user32 function.
jscript code:
Interop.Call("user32","SetWindowTextW",hWnd,"new window title");

example:
jscript code:
function OnEvent_ChatWndCreated(ChatWnd){
var contact;
for(e=new Enumerator(ChatWnd.Contacts);!e.atEnd();e.moveNext())contact=e.item();
Interop.Call("user32","SetWindowTextW",ChatWnd.handle,MsgPlus.RemoveFormatCodes(Messenger.MyName)+": "+MsgPlus.RemoveFormatCodes(contact.name));
}

This post was edited on 11-28-2008 at 10:36 PM by roflmao456.
[quote]
Ultimatess6
: What a noob mod
11-28-2008 10:32 PM
Profile PM Web Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: account name in taskbar (msn polygamy)
I think something like this would work. I am at work and cannot test it but this is what it does

It will change the title of the window if it isn't in the foreground and restores it when the window is brought forward. There is already a glitch I can tell of without even running it and that would be if the contact changes their name then the script wont update it and the new title will be visible. But this is something that could be worked upon.

jscript code:
var oChatWnds = { };
var oChatWnds_WinTitle = { };

function OnEvent_ChatWndSendMessage( pChatWnd, sMessage ) {
    oChatWnds[ pChatWnd.Handle ] = sMessage;
}

function OnEvent_ChatWndDestroyed( pChatWnd ) {
    delete oChatWnds[ pChatWnd.Handle ];
    delete oChatWnds_WinTitle[ pChatWnd.Handle ];
}

function OnEvent_ChatWndReceiveMessage( pChatWnd, sOrigin, sMessage, nMessageKind ) {
    // check if the event is thrown because our message was recieved in the chat history
    if ( oChatWnds[pChatWnd.Handle] !== sMessage ) {
        // check if the current window isn't the chat window
        if ( Interop.Call( 'user32', 'GetForegoundWindow' ) !== pChatWnd.Handle ) {
            // get the current title to restore once the window has been brought forward
            var intTitleLength = Interop.Call( 'user32', 'GetWindowTextLengthW', pChatWnd.Handle );
            var lpszTitle = Interop.Allocate( intTitleLength );
            Interop.Call( 'user32', 'GetWindowTitleW', pChatWnd.Handle, lpszTitle, intTitleLength );
            oChatWnds_WinTitle[ pChatWnd.Handle ] = lpszTitle.ReadString( 0 );
           
            // create a string to hold the new title
            var lpszNewTitle = MsgPlus.RemoveFormatCodes( Messenger.MyName )+' : ';
            // loop through all of the contacts
            for( var oContact = new Enumerator( pChatWnd.Contacts ); !oContact.atEnd(); oContact.moveNext() ) {
                // concatenate a string for all participants
                lpszNewTitle += MsgPlus.RemoveFormatCodes( oContact.item().Name ) + ( oContact.atEnd() ? '', ', ' );
            }
           
            // set the new title for the window
            Interop.Call( 'user32', 'SetWindowTextW', pChatWnd.Handle, lpszNewTitle );
           
            // use a timer to verify when the window is brought to the front
            MsgPlus.AddTimer( pChatWnd.Handle, 100 );
        }
    }
}

function OnEvent_Timer( sTimerId ) {
    // check if the window is the front window
    if ( Interop.Call( 'user32', 'GetForegroundWindow' ) !== sTimerId ) {
        // since the window is still in the background lets make sure it still exists before readding the timer for it
        if ( Interop.Call( 'user32', 'IsWindow', sTimerId ) ) MsgPlus.AddTimer( sTimerId, 100 );
       
        // exit the function
        return;
    }
   
    // set the old window title now that the window is brought forward
    Interop.Call( 'user32', 'SetWindowTextW', sTimerId, oChatWnds_WinTitle[ sTimerId ] );   
}

This post was edited on 11-28-2008 at 11:34 PM by matty.
11-28-2008 11:32 PM
Profile E-Mail PM Find Quote Report
lespoils
New Member
*


Posts: 4
40 / Male / Flag
Joined: Nov 2008
O.P. RE: account name in taskbar (msn polygamy)
hi again,

thx for the replies and information.

i tried pasting the  script you supplied but it doesnt seems to work. the exact error is:

Error: Expected ':' (code: -2146827285)
       File: test.js. Line: 29.

trying to understand what you did, maybe i'll manage to make it work sometime

thanks again
Lespoils
12-01-2008 03:35 AM
Profile PM Find Quote Report
lespoils
New Member
*


Posts: 4
40 / Male / Flag
Joined: Nov 2008
O.P. RE: account name in taskbar (msn polygamy)
where can i read about the setwindowtextW function ?
12-01-2008 04:17 AM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: account name in taskbar (msn polygamy)
quote:
Originally posted by lespoils
where can i read about the setwindowtextW function ?
SetWindowText Function()
quote:
Originally posted by lespoils
hi again,

thx for the replies and information.

i tried pasting the  script you supplied but it doesnt seems to work. the exact error is:

Error: Expected ':' (code: -2146827285)
       File: test.js. Line: 29.

trying to understand what you did, maybe i'll manage to make it work sometime

thanks again
Lespoils
Line 29:
code:
lpszNewTitle += MsgPlus.RemoveFormatCodes( oContact.item().Name ) + ( oContact.atEnd() ? '', ', ' );
Should be:
code:
lpszNewTitle += MsgPlus.RemoveFormatCodes( oContact.item().Name ) + ( oContact.atEnd() ? '' : ', ' );
12-01-2008 02:30 PM
Profile E-Mail PM Find Quote Report
lespoils
New Member
*


Posts: 4
40 / Male / Flag
Joined: Nov 2008
O.P. RE: account name in taskbar (msn polygamy)
thx again matty,

will try that tonight, i do have a quick question for now,

why do u put a W at the end of the SetWindowsText function ?
is it something about Messenger Plus! script ?

Lespoils
12-01-2008 07:48 PM
Profile PM Find Quote Report
Spunky
Former Super Mod
*****

Avatar

Posts: 3658
Reputation: 61
36 / Male / Flag
Joined: Aug 2006
RE: account name in taskbar (msn polygamy)
quote:
Originally posted by lespoils

why do u put a W at the end of the SetWindowsText function ?
is it something about Messenger Plus! script ?

Lespoils

It's because JScript is Unicode. The alternate version would be SetWindowTextA (I think it means ASCII). Although, I don't think you need to explicitly call those with the A at the end
<Eljay> "Problems encountered: shit blew up" :zippy:
12-01-2008 07:54 PM
Profile PM Find Quote Report
matty
Scripting Guru
*****


Posts: 8336
Reputation: 109
39 / Male / Flag
Joined: Dec 2002
Status: Away
RE: account name in taskbar (msn polygamy)
quote:
Originally posted by Spunky
quote:
Originally posted by lespoils

why do u put a W at the end of the SetWindowsText function ?
is it something about Messenger Plus! script ?

Lespoils

It's because JScript is Unicode. The alternate version would be SetWindowTextA (I think it means ASCII). Although, I don't think you need to explicitly call those with the A at the end
You certainly do need to. Otherwise the function will not know how to the parameters and how much memory to allocate to it.
12-01-2008 08:28 PM
Profile E-Mail PM Find Quote Report
« Next Oldest Return to Top Next Newest »


Threaded Mode | Linear Mode
View a Printable Version
Send this Thread to a Friend
Subscribe | Add to Favorites
Rate This Thread:

Forum Jump:

Forum Rules:
You cannot post new threads
You cannot post replies
You cannot post attachments
You can edit your posts
HTML is Off
myCode is On
Smilies are On
[img] Code is On