Messenger Plus! Random Text Script

Further to my earlier post about Messenger Plus! Live, I decided to flex my Javascript skills so I attempted to write a script for Messenger Plus! Live. It was dead easy to write a script; even easier than writing a Firefox extension. I suppose my script is fairly basic as it doesn’t require any new UI or i18n or anything but I’m still quite impressed how easy Patchou made it to write a script.

This is a dead simple script. All it does is it reads a text file every 10 minutes, picks out a random non-blank line from that file and then sets that as your Personal Message on Messenger. You could use this script with IRC logs, a list of quotes, etc.

Source Code

function updateMessage() {
    FileSystem = new ActiveXObject("Scripting.FileSystemObject");
    file = FileSystem.OpenTextFile("E:/Documents/testfile.txt", 1);
    i = 0;
    lines = new Array();

    while(!file.AtEndOfStream) {
        line = file.ReadLine();
        if (line != '') {
            lines[i] = line;
        }
        i++;
    }

    file.Close();
    linenum = Math.floor(Math.random()*lines.length)-1;
   
    Messenger.MyPersonalMessage = lines[linenum];
}

function OnEvent_Initialize(MessengerExit) { }
function OnEvent_Uninitialize(MessengerExit) { }

function OnEvent_Signin(email) {
    if (email == Messenger.MyEmail) {
        updateMessage();
        MsgPlus.AddTimer('randomtext', 600000);
    }
}

function OnEvent_Timer(timerId) {
    if (timerId == 'randomtext') {
        updateMessage();
        MsgPlus.AddTimer('randomtext', 600000);
    }
}

Hopefully most of this script should be fairly self-explanatory. OnEvent_Signin is called when a user signs in. This function checks that it is the current user who has just signed in, and if so calls updateMessage() and schedules the next call for in 10 minutes time.

OnEvent_Timer gets called when a timer is triggered – in this case it’ll get called after 10 minutes. The function calls updateMessage() and schedules the next call for in another 10 minutes time. updateMessage() opens a text file, reads the whole file putting it into an array and then selects a random line and sets it as the personal message. 

Usage

To use it, go to Plus > Scripts and select "Create New". Enter a name for the script and paste the contents of the script above into it and save it. You’ll have to sign out/sign in or restart Messenger to make it work. Make sure you’ve also changed the path to the text file which is E:/Documents/testfile.txt by default.

It’ll overwrite your whole personal message. If you want it to appear as part of your personal message, concatenate the random line with something else. For example, you could change:

Messenger.MyPersonalMessage = lines[linenum];

To:

Messenger.MyPersonalMessage = 'My Personal Message | '+lines[linenum]; 

If you want to change the update interval, change the value of 600000 (600000ms is 10 minutes).

19 thoughts on “Messenger Plus! Random Text Script

  1. hi i want to download MSN MESSENGER PLUS WITHOUT LIVE! but it just won’t let me! …I have tried downloading loadsa different msn to get it but still can’t! Please email me i won’t remember this website! shopaholic165342@aol.com Thank you for your time! Mrs.Flitstik

  2. Hi.

    For some reason this didn’t work for me, so I changed it a little bit (I got errors in the OnEvent_Signin() function, something about line 3 that ” isn’t a valid name).

    I put:

    updateMessage();
    MsgPlus.AddTimer(‘randomtext’, 600000); 

    in the OnEvent_Initialize() function and deleted the OnEvent_Signin() function. Now it works.

    Also, remember that when you specify the filename of the PM file and you’re using a backslash, make sure to use 2 backslashes (\\) instead of 1. If you don’t you’ll get a "File not found" error.

    Thanks anyway! 

  3. i cant download msn plus without having to download live messenger which i don’t want. how can i download msn plus without having 2 do this?

  4. Heloo im in skwll Lol it borin im tryin 2 find msn 2 chat 2 all my friends it get on my nevers  im sooo in Love with this boyy  im soo bored  and tried

  5. Msn Live Is Really Bad!.. Can You Help Me Get The Normal Just Msn Plus Back Not Msn Plus! Live .. Cos It Says Everyone Is Offline ! And There Are Loads Of People Online !! … Can You Give Me Like Directions Cos I Went On A Good Website For Getting It Back!.. But It Needed A Activation Code :S:S .. And I Didn`t Have A Clue What That Meant!!..xxx

     

    Pleaseee Help Me !! 😀 xx Thanks xx  .. FromEllieBolingbroke !! REPLY PLEASE !!

    • Msn Live Is Really Bad!.. Can You Help Me Get The Normal Just Msn Plus Back Not Msn Plus! Live .. it not let me download it !! ARRRHH

  6. OK my frind has downloaded this file that happened to be a shitty scrip thats now obducted her msn and her desktop so she has messages getin sent to al her contacts wen they chat 2 her and its sayin is this a photo of you and gives a link 2 this php site bolox so any1 clever enuf to work out how 2 successfully remove this as its not detected as a trojan or a virus cus as evry 1 with half a brian knows this isnt a virus or trojan but a scrip which is just as clever as a virus an trojan put 2gether so nay ideas where this crap goes to on msn and how 2 remove it plz add my email and let me know an no i dont check this site often and yer this me 1st tym so probly be me last especially if i dont get a reply which i aint as yet so any ideas email me i have loads of stuff 2 offer if you can help and she a really sweet gurl im tryin 2 help so plz be quick with ya respons ya know gurls dont like w8in lmfao 😛 seriously if ya know tell me asap thanks 😛

  7. Okay people if you were downloading MSN plus from the actual site you wouldnt need an activation code,

    Also to the girl with the script thingy that send viruses or what eve out

    Thats called the MSN VIRUS

    You need to make a new MSN account

  8. helloo 🙂

    i really need good writing on my msn name ;, but i cant find any like that are really basic but look really good on your name all my friends have them on their names but they tell me they dont no how to do it :S , every site i have been on they are all the same and everyone uses them !
    please can you help me ?:D
    can you tell me what site to go on please ?:)
    X

Leave a Reply

Your email address will not be published. Required fields are marked *