|
Packaging your Script
Having the best script in the world is pretty much useless if
you can't share it with other people. Because scripts were designed
to be rapidly developed, they were also designed to be rapidly
shared. For that reason, Messenger Plus! Live comes with its own
script installation mechanism called Script Pack.
A Script Pack is a single file, with a ".plsc" extension,
containing all the files and sub directories of your script.
Creating such a file is ridiculously easy for simple reason: Script
Packs are just and only plain zip files with a different extension.
This means that you only need to zip all the files in your script
directory (with your favorite zip tool, like Winzip) and replace the ".zip"
extension with ".plsc". Only one thing is required to make your zip
file a valid Script Pack: a ScriptInfo.xml file.
ScriptInfo.xml is a file placed in
the script's directory (along with ".js" files). It is read when
the script is loaded or imported and contains several information
related to the script such as its name, its description, the menus
it displays in Messenger, etc... the file does not need to be
created for scripts to run locally, however, its presence is
mandatory if the script has to be exported into a Script Pack. A
full description of the content of the file can be found in the
ScriptInfo Schema
Reference, here is however an example of a simple ScriptInfo
file that you can use for your script:
<ScriptInfo>
<Information>
<Name>My First Script</Name>
<Description>This is my first script.</Description>
<AboutUrl>http://www.msgpluslive.net</AboutUrl>
<Version>1.00</Version>
</Information>
</ScriptInfo>
Just copy paste what's above in a new text file, save it in your
script's directory and rename it to "ScriptInfo.xml". The xml file
can be saved in Unicode (UTF-16) if your language requires it. Now,
select all the files in your script's directory, zip them and
rename the zip file with a ".plsc" extension (example: rename "My
First Script.zip" to "My First Script.plsc"). Your Script Pack is
ready to go! to test it, just sign in Messenger and double click on
the plsc file you've just created, if you followed the steps above
correctly, you will get the "Import Script" window of Messenger
Plus! Live. Once the script is imported, it is automatically
activated. If a script with the same name already exists in the
user's directory, its files are transparently replaced with the new
ones (useful for upgrades).
In the XML code specified above, only <Name> is a required element. <Description>, <AboutUrl>, and <Version> can be removed if not needed. To
ensure forward compatibility, specify the version of the script in
the <Version> element (Messenger
Plus! Live 4.20 and later) and not in the <Name> element. This will prevent duplicated
copies of the same script from being installed on a user's system
(as the name of the script is used to create the corresponding
script's directory).
If you look at the first picture in ScriptInfo Schema
Documentation, you'll see that several other elements are also
available aside from <Information>. Two of them can be used
during import: <OleFiles> and
<DotNetFiles>. These are to be
used if your script replies on external COM/ActiveX or .NET objects
created by yourself or not supposed to come in standard with
Windows. Files listed in those two elements will be registered
properly in the system when the script is imported. For example, if
you created an ActiveX object in VisualBasic for your script called
"ExtraFunctionsVB.dll" (loaded with JScript's
ActiveXObject object), your ScriptInfo file would have to look
like this:
<ScriptInfo>
<Information>
<Name>My First Script</Name>
</Information>
<OleFiles>
<FileName>ExtraFunctionsVB.dll</FileName>
</OleFiles>
</ScriptInfo>
If you still have doubts about how to do something in particular
in your ScriptInfo.xml file, you can
download existing Script Pack files, change their extension to
".zip" and take a look at how the developer of the script created
his own ScriptInfo file. Also, remember to always use a good XML
editor to create your XML files as a real XML editor can validate
your syntax and insure that your elements conform to the specified
schema file. This will save
you long hours of searching for errors caused by a missing or
invalid tag in your XML file.
See Also
Introduction to Scripting, ScriptInfo Schema Reference.
|