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:
Yorick
Junior Member
**

Avatar

Posts: 22
33 / Male / Flag
Joined: Mar 2007
O.P. Plugin manager
Ok I need some advise on this peace of my script. I want to make a plugin manager for my script, as you might know I'm working on a last.fm script. The point is that there are a lot of different feeds available so I want to give people the choice what feeds they want.

But how should I organise this? I was thinking of the following:
[Directory]

- [Last.fm]
- - main files
- - [Plugins]
- - - [TopArtists]
- - - WndTopArtists.xml
- - - JsTopArtists.js
- - - [TopTracks]
- - - WndTopTracks.xml
- - - JsTopTracks.js

But the problem is that Messenger Plus! Live only grabs the Jscript files in the main directory. How can I make it so that it also grabs the Jscript files in my Plugins directory?

Thanks in advance!
03-04-2007 03:08 PM
Profile E-Mail PM Web Find Quote Report
Felu
Veteran Member
*****


Posts: 2223
Reputation: 72
29 / Male / Flag
Joined: Apr 2006
Status: Away
RE: Plugin manager
Why not just keep the js files in the main folder? Or make a js file which reads the js files in the Plugins folders and put the data in them itself. You can use FileSystemObject for it. Just ask if you need any help with it ;).
03-04-2007 03:11 PM
Profile E-Mail PM Web Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: Plugin manager
The best way is just to keep them all in the same folder.
03-04-2007 03:15 PM
Profile PM Find Quote Report
Yorick
Junior Member
**

Avatar

Posts: 22
33 / Male / Flag
Joined: Mar 2007
O.P. RE: Plugin manager
quote:
Originally posted by Felu
Why not just keep the js files in the main folder? Or make a js file which reads the js files in the Plugins folders and put the data in them itself. You can use FileSystemObject for it. Just ask if you need any help with it ;).

Ok I'll look into that! Thanks for the help, but I'll try it myself first :D! Is there maybe a script that does something similar like this? Including a other Jascript file in itself?

quote:
Originally posted by deAd
The best way is just to keep them all in the same folder.
Yes that came to my mind later, would it be handy to use some sort of a prefix so I can find them easily? Like:
Plugin_WndTopArtists.xml
Plugin_JsTopArtists.js

Or does anyone has a better idea how to do that?

This post was edited on 03-04-2007 at 03:18 PM by Yorick.
03-04-2007 03:16 PM
Profile E-Mail PM Web Find Quote Report
deAd
Scripting Contest Winner
*****

Avatar

Posts: 1060
Reputation: 28
– / Male / Flag
Joined: Jan 2006
RE: RE: Plugin manager
quote:
Originally posted by Yorick
quote:
Originally posted by deAd
The best way is just to keep them all in the same folder.
Yes that came to my mind later, would it be handy to use some sort of a prefix so I can find them easily? Like:
Plugin_WndTopArtists.xml
Plugin_JsTopArtists.js
Yes, that's perfectly fine. If you look at the Screenshot Sender script or my Stickynotes script (among others) you'll see that the files are prefixed to help organize them :)

Don't do the file reading, that's a terrible method.
03-04-2007 03:19 PM
Profile PM Find Quote Report
Yorick
Junior Member
**

Avatar

Posts: 22
33 / Male / Flag
Joined: Mar 2007
O.P. RE: RE: RE: Plugin manager
I think you're right, don't need it anymore because there all in the main directory now, I'm going to write the manager now. Thanks a lot for your advices!

This post was edited on 03-04-2007 at 03:36 PM by Yorick.
03-04-2007 03:35 PM
Profile E-Mail PM Web Find Quote Report
Yorick
Junior Member
**

Avatar

Posts: 22
33 / Male / Flag
Joined: Mar 2007
O.P. RE: Plugin manager
Ok for anyone who's interested this is how I've done it.

Every plugins has 3 files,
- Plugin_TopArtistsInfo.xml, with some information about the plugin: name, descriptiong and id.
- Plugin_TopArtistsWnd.xml with the window(s) for the plugin.
- Plugin_TopArtistsJs.js with the Jscript functions for the plugin.

And last but not least the manager itself (currently only listing of plugins)

[Image: img3.png]

This post was edited on 03-04-2007 at 07:50 PM by Yorick.
03-04-2007 07:46 PM
Profile E-Mail PM Web Find Quote Report
-dt-
Scripting Contest Winner
*****

Avatar
;o

Posts: 1819
Reputation: 74
35 / 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 »


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