Messenger Plus! Random Text Script

June 25th, 2006

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).

About the Author: Hi! I'm Ken. I've been using mobiles for over 10 years and technology for a lot longer! I'd love to hear from you.

Like this tip? Get the most from your mobile phone...

  • Discover brand new ways to use your mobile phone
  • Techniques to get more out of your mobile phone for less
  • Be the first to learn about new mobile technology

Enter your email to receive free regular Ken's Tech Tips:

  1. MSN Messenger Sign-in Problems
  2. Messenger Plus! Live
  3. Releases: Windows Live Messenger, Yahoo, Opera
  4. The Mystery White Box of MSN/Windows Live Messenger
  5. Windows Live Messenger Review

19 Responses to “Messenger Plus! Random Text Script”

  1. Mrs Flitstikon 02 Sep 2006 at 11:08 am

    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. Fon 02 Dec 2006 at 6:12 am

    niceeeeeeeeee

  3. G1otison 19 Dec 2006 at 8:42 pm

    thnxxxxxxx

  4. Rsterenbon 06 Jan 2007 at 7:39 pm

    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! 

  5. Hayleyon 10 Jan 2007 at 10:08 pm

    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?

  6. Georgiieeeon 13 Feb 2007 at 12:03 pm

    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

  7. Serbulenton 22 Feb 2007 at 7:18 am

    hi,

    if i want to change this script that not work for random. what must i do?

  8. Smellyellieeon 21 Feb 2007 at 6:03 pm

    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 !! :D xx Thanks xx  .. FromEllieBolingbroke !! REPLY PLEASE !!

  9. Davidon 23 Mar 2007 at 9:39 pm

    can u help me to fing out the activation code for msn plus it is doin my head in plzzzz can  anyone help me and add me if u no it thanks a lot david http://cow.neondragon.net/ui/emoticons/ninja.png

    (dhliptrot@hotmail.com)

    http://cow.neondragon.net/ui/emoticons/ninja.png

    (davidliptrot@hotmail.co.uk)

    http://cow.neondragon.net/ui/emoticons/ninja.png

  10. Sylviaon 02 Apr 2007 at 9:35 pm

    hey if you ac msn pluc try *oxfam nd see 4 yourself

  11. Lauraon 03 Apr 2007 at 7:06 pm
    • 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

  12. Jenyfron 08 Apr 2007 at 6:35 pm

    ryt does any1 kno har til get MSN weird maker writng as yer normal msn writn  ??

  13. Jayon 04 Apr 2007 at 9:03 pm

    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 :P seriously if ya know tell me asap thanks :P

  14. Khloon 10 Apr 2007 at 12:36 pm

    This is not the Messenger Plus support forum. Please use the forums at http://www.msghelp.net/ for support with Messenger Plus.

  15. Emmaon 10 Apr 2007 at 11:46 am
     hellow can u help me well iam damloding msn plus and it says msn code what it it HELP ME NOW
     PLZ HELP ME!
  16. Emmaon 10 Apr 2007 at 11:48 am

    HELP ME IAM DAMLODING MSN AND IT SAY I NEED TO BUT ,

    IN THIS CODE,

    WHAT IS THE CODE,

    PLZ HELP ME!

    FROM EMMA !

  17. Chrison 28 Jan 2009 at 12:44 am

    Thanks is there a way i could do alert(1) in javascript and make a pop popup on there screen??

  18. Jesseon 21 Jun 2009 at 3:15 am

    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

  19. laurenon 24 Jun 2009 at 7:49 pm

    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

Trackback URI | Comments RSS

Leave a Reply