Shoutbox

Contact singout script, need some advice - Printable Version

-Shoutbox (https://shoutbox.menthix.net)
+-- Forum: MsgHelp Archive (/forumdisplay.php?fid=58)
+--- Forum: Messenger Plus! for Live Messenger (/forumdisplay.php?fid=4)
+---- Forum: Scripting (/forumdisplay.php?fid=39)
+----- Thread: Contact singout script, need some advice (/showthread.php?tid=76835)

Contact singout script, need some advice by scutterman on 08-17-2007 at 12:19 PM

Hi I have made a script which uses the DisplayToastContact feature inside the ContactSignOut to tell you about a contact who has just signed out.

The script:

code:
function OnEvent_Initialize(MessengerStart)
{

Debug.Trace("Script Started")

}

// This is so I can get the Email of a contact who has just signed out
function OnEvent_ContactSignout(Email)
{
    // This is to get all og the details I need
    var details = Messenger.MyContacts.GetContact(Email)
   
    // I want to use this to add the pic to the toast but I don't know how
    var pic = details.DisplayPicture
   
    // This is to get the name to use in DisplayToastContact
    var name = details.Name
   
    // This is to make the script neater
    var message = " has signed out"

    // This is the Toast
    MsgPlus.DisplayToastContact("Contact SignOut",name,message,"online.mp3")

}


function  OnEvent_Uninitialize(MessengerExit)
{

Debug.Trace("Script Ended")

}




I want to know if it is possible to have the display pic in the toast as well (like msn does when it tells you when a contact has signed in)

I would also like to know how I can crop names that are over a certain length and add the "..." so It doesn't just cut off the names which are too long (also like msn does for contact sign in)

Thanks for all of your help
~~Scutterman~~

RE: Contact singout script, need some advice by matty on 08-17-2007 at 01:07 PM

You cannot show an image on the window.
You can check the length of the contacts Name property and see how long it is then you can resize and add "...".

code:
if (name.length > 10 /* change to whatever you want */) name = name.substr(0, 10/* change to whatever you want */) + '...';

RE: Contact singout script, need some advice by scutterman on 08-17-2007 at 03:27 PM

Thanks for that, helped alot.
~~Scutterman~~


RE: Contact singout script, need some advice by scutterman on 08-20-2007 at 01:02 PM

Hi, just a quick not to say that the script:

code:

    if (name.length > 17)
    {
    name = name.substr(17) + '...';
    }



cut off everything from character 0 to 16. After a bit of playing around with it I worked out that it should have been:

code:

    if (name.length > 17)
    {
    name = name.substr(0,17) + '...';
    }



Just thought I'd mention it in case any other scripters look at this thread looking for a similar thing

later
~~Scutterman~~