What happened to the Messenger Plus! forums on msghelp.net?
Shoutbox » MsgHelp Archive » Messenger Plus! for Live Messenger » Scripting » Plugin manager

Plugin manager
Author: Message:
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
36 / Male / Flag
Joined: Mar 2004
RE: Plugin manager
Ok heres how i do it in Now Playing

players filenames are formatted as
classname.player.js

so lets say theres a file called "winamp.player.js"

and inside it there is

code:

var winamp = function(){


}

winamp.prototype = {
"helloWorld" : function(){
Debug.Trace('hello world');
}

}



and then we run this code, which loads all files in the /players directory and stores them into the plugins object

code:
    var x;
    var plugins = {};
    var loadedPlugins = [];
    for(var enume = new Enumerator(fso.GetFolder(MsgPlus.ScriptFilesPath + "\\players").Files);!enume.atEnd();enume.moveNext()){
        if(x = new String(enume.item()).match(/([^[\\]*?)\.player\.js$/)){
            loadedPlugins.push(x[1]);
           
            try{
                eval(fso.GetFile(enume.item()).OpenAsTextStream(1, 0).ReadAll());
                plugins [x[1]] = eval(x[1]);
            }catch(e){
                    Debug.Trace("ERROR loading player " + x[1] + ": \nType: " + e['name'] + "\nMessage: " + e['message'] + "\nNumber: " + x['number'] + "\nDescription: " + x['description']);
            }
        } 
    }




and then we can just use

code:
plugins['winamp'].helloWorld();

[Image: dt2.0v2.png]      Happy Birthday, WDZ
03-04-2007 11:36 PM
Profile PM Web Find Quote Report
« Next Oldest Return to Top Next Newest »

Messages In This Thread
Plugin manager - by Yorick on 03-04-2007 at 03:08 PM
RE: Plugin manager - by Felu on 03-04-2007 at 03:11 PM
RE: Plugin manager - by deAd on 03-04-2007 at 03:15 PM
RE: Plugin manager - by Yorick on 03-04-2007 at 03:16 PM
RE: RE: Plugin manager - by deAd on 03-04-2007 at 03:19 PM
RE: RE: RE: Plugin manager - by Yorick on 03-04-2007 at 03:35 PM
RE: Plugin manager - by Yorick on 03-04-2007 at 07:46 PM
RE: Plugin manager - by -dt- on 03-04-2007 at 11:36 PM


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