Installation Packages (MM4)
Installation Packages structure
Additional Extensions can be easily installed in MediaMonkey using Installation Packages. Each installation package is a ZIP file with MMIP extension, when such a file is executed, it is automatically installed in MediaMonkey (see Tools|Extensions menu item). Inside the package can be included any files that need to be installed, but there are also some special files that can or must be included:
- Install.ini
- Mandantory - this file describes the package and what to install.
- App.ico
- Optional - Icon of the package.
- Uninstall.ini
- Optional (but suggested) - describes steps on uninstall, which files to remove, etc.
- Uninstall.vbs
- Optional - is automatically preserved by installer and can be called by Uninstall.ini on uninstallation.
Install.ini file
The installation file has a structure of an ini file, i.e. some sections with keys and values.
[Header] section
Each install.ini file starts with a mandantory section [Header]. It contains basic information about the product being installed, namely:
- ID
- Unique string identification of the product. It should contain only alphanumeric characters, digits or underscores.
- Title
- Product title shown to user.
- Description
- Detailed product description.
- VersionMajor
- Major version number.
- VersionMinor
- Minor version number.
- VersionRelease
- Release number.
- VersionBuild
- Build number. Any of these numbers can be missing, e.g. if only VersionMajor and VersionMinor are present, the version number shown to user would be 'VersionMajor.VersionMinor'.
- Type
- Type of product being installed. Either script, skin or misc. This is used so that MM knows more about the extension.
- UpdateURL
- URL where MM should look for updates of this product. If this key is missing, MM can still try to find out whether a new version has been released by asking MM web scripting repository using product ID above.
Other sections
After the header section, there can follow an arbitrary number of other sections specifying actions installer should do. The possible sections follow.
[Copy] section
This section tells where individual files from the installer ZIP file should be placed. Expected keys there include:
- Src
- Source file name in the installer ZIP file.
- Tgt
- Destination file path. It can contain constants useful for placing files in common paths (the same as InnoSetup constants). Currently implemented constants:
- {app} = MediaMonkey installation folder.
- Flags
- Comma separated list of flags related to this copy operation. Can be any of:
- Overwriteifnewer
- If the target file already exists, it will be overwritten only if the source file is newer. If this flag isn't specified, the target file will always be overwritten.
If your package contains various files to be copied, you need one [Copy] Section for each individual file.
[Delete] section
This section is primarily for 'uninstall.ini' file. The only parameter is:
- File
- Full path of the file to be deleted.
[Execute] section
This section allows developer to execute a script and thus do any other necessary installation/uninstallation actions, for example prepare Scripts.ini content. Expected keys here are:
- File
- A script file to execute. There is either a fully specified path entered here, or if there is no path information, the script is expected to be located in the installation ZIP file and is prepared to a temporary location prior its execution. For uninstaller 'uninstall.vbs' can be specified here and it would be called from its location.
- Function
- A name of function to be called within the script file. If this entry is missing or empty, it's supposed that there's no need for calling a function and simple execution of the script file does whatever a developer wants to do.
Uninstall.ini file
'Uninstall.ini' file will is very similar to 'Install.ini' file, just [Header] section is missing. Other sections allow developers to properly delete installed files and remove any other traces of installation, e.g. execute a script that would delete some entries in Scripts.ini file.
Sample Installation Package for Skins
Sample MMIP file can contain e.g. the following files:
- App.ico icons shown in the extenions dialog
- Install.ini file that tells where stuff is copied to
- Uninstall.ini tells what should be deleted when uninstalling
Sample Install.ini file
Comments in [] should be removed
[Header]
ID=UniqueSkinName [this is used when MM needs to see if update is available]
Title=Skin Name
Description=Well a description
VersionMajor=1
VersionMinor=0
VersionRelease=0
VersionBuild=0
Type=skin [so MM knows what it is]
UpdateURL= [leave blank no specs are out yet]
[Copy]
Src=skinfile.wsz
Tgt={app}\skins\skinfile.msz
[Copy]
[you can copy more stuff if you want]
Sample Uninstall.ini file
[Delete]
File={app}\skins\skinfile.msz
File={app}\skins\someicon.ico
Sample Installation Package for Scripts
Sample content of MMIP file
Sample MMIP file can contain e.g. the following files:
- App.ico
- Install.ini
- Sample Option Sheets.vbs
- Uninstall.ini
- Uninstall.vbs
Sample Install.ini file
[Header]
ID=MyScript1
Title=Sample Option Sheets
Description=Sample Option Sheets.vbs
VersionMajor=1
VersionMinor=0
VersionRelease=0
VersionBuild=0
Type=script
UpdateURL=http://localhost/myscript1/version.xml
[Copy]
Src=Sample Option Sheets.vbs
Tgt={app}\scripts\auto\Sample Option Sheets.vbs
[Copy]
Src=Sample.ico
Tgt={app}\scripts\auto\Sample.ico
[Copy]
Src=Icons\*.*
Tgt={app}\Icons\
[Execute]
File={app}\scripts\auto\Sample Option Sheets.vbs
Function=OnStartup()
Alternative is to use an install.vbs
[Execute]
File=install.vbs
Sample install.vbs
scriptName = "Sample Script"
'Add scripts.ini entries
Dim inip : inip = SDB.ApplicationPath&"Scripts\Scripts.ini"
Dim inif : Set inif = SDB.Tools.IniFileByPath(inip)
If Not (inif Is Nothing) Then
inif.StringValue(scriptName,"Filename") = "Auto\AdvShutdown.vbs"
inif.StringValue(scriptName,"Procname") = "ShutdownUI"
inif.StringValue(scriptName,"Order") = "99"
inif.StringValue(scriptName,"DisplayName") = "Advanced Shutdown"
inif.StringValue(scriptName,"Description") = "Shuts down PC after some time with more options"
inif.StringValue(scriptName,"Language") = "VBScript"
inif.StringValue(scriptName,"ScriptType") = "0"
inif.StringValue(scriptName,"Shortcut") = "Ctrl+Shift+s" 'don't use this combo as it is already used in other scripts
SDB.RefreshScriptItems
End If
' Add entries for Mediamonkey.ini
' Here you set the variables you need
' all 3 types are shown here
Dim ini: Set ini = sdb.IniFile
If ini.StringValue("AdvShutdown","Enabled") = "" Then
ini.BoolValue("AdvShutdown","Enabled") = Enabled
End If
If ini.BoolValue("AdvShutdown","Timeout") = "" Then
ini.StringValue("AdvShutdown","Timeout") = True
End If
If ini.IntValue("AdvShutdown","Action") = "" Then
ini.IntValue("AdvShutdown","Action") = 1
End If
Sample Uninstall.ini file
[Delete]
File={app}\scripts\auto\Sample Option Sheets.vbs
File={app}\scripts\auto\Sample.ico
[Execute]
File=Uninstall.vbs
Sample Uninstall.vbs file
myName = "Sample Script" 'Put script name here
iniSec = "SampleScript" 'Put ini section name here
' Deletes settings from MediaMonkey.ini
MsgDeleteSettings = "Do you want to remove " & myName & " settings as well?" & vbNewLine & _
"If you click No, script settings will be left in MediaMonkey.ini"
If (Not (SDB.IniFile Is Nothing)) and (MsgBox(MsgDeleteSettings, vbYesNo) = vbYes) Then
SDB.IniFile.DeleteSection(iniSec)
End If
'Remove entries from scripts.ini
Dim inip : inip = SDB.ApplicationPath&"Scripts\Scripts.ini"
Dim inif : Set inif = SDB.Tools.IniFileByPath(inip)
If Not (inif Is Nothing) Then
inif.DeleteSection(myName)
SDB.RefreshScriptItems
End If