What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Use existing array to generate random quote in personal message?

Use existing array to generate random quote in personal message?
Author: Message:
albert
Veteran Member
*****

Avatar

Posts: 2247
Reputation: 42
– / Male / Flag
Joined: Feb 2005
RE: Use existing array to generate random quote in personal message?
Bump :

here's the script I made you. It works pretty simply, it reads quotes out of a text file, and then displays one randomly in your personal message every time you start Windows Live Messenger.

You can change the fileLocation to the path you desire, just remember to change the \ for a double. (\\)

Depending on the number of quotes you have, you also have to change the numberOfQuotes number, and put the number of lines you have (should be easy since you kept it in an array, therefore you know how many rows you have..).

I hope it helps, here's the code :

code:
function OnEvent_Initialize(MessengerStart)
{
    numberOfQuotes = 18 ;
    fileLocation = "C:\\quotes.txt" ;

    fileStream = new ActiveXObject("Scripting.FileSystemObject");
    f = fileStream.OpenTextFile( fileLocation, 1, true) ;

    randomNumber = Math.random( ) * numberOfQuotes  ;

    for ( var i = 0 ; i < randomNumber ; i ++ )
        quoteSelected = f.ReadLine( ) ;
   
    Messenger.MyPersonalMessage = quoteSelected ;
}

function OnEvent_Uninitialize(MessengerExit)
{
}


Report any problems.

This post was edited on 06-08-2007 at 01:36 AM by albert.
06-08-2007 01:24 AM
Profile E-Mail PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Use existing array to generate random quote in personal message? - by stu on 06-07-2007 at 08:37 PM
RE: Use existing array to generate random quote in personal message? - by albert on 06-07-2007 at 10:10 PM
RE: Use existing array to generate random quote in personal message? - by albert on 06-08-2007 at 01:24 AM
RE: Use existing array to generate random quote in personal message? - by stu on 06-08-2007 at 01:55 AM
RE: Use existing array to generate random quote in personal message? - by albert on 06-08-2007 at 02:19 AM
RE: Use existing array to generate random quote in personal message? - by stu on 06-08-2007 at 02:33 AM
RE: Use existing array to generate random quote in personal message? - by albert on 06-08-2007 at 03:47 AM
RE: Use existing array to generate random quote in personal message? - by stu on 06-08-2007 at 12:26 PM
RE: Use existing array to generate random quote in personal message? - by stu on 06-09-2007 at 12:25 AM


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