Installation Packages (MM4): Difference between revisions
(Added multiple copies sample to Install.ini) |
|||
Line 129: | Line 129: | ||
<source lang="vb"> | <source lang="vb"> | ||
myName = "Sample Script" 'Put script name here | |||
iniSec = "SampleScript" 'Put ini section name here | |||
MsgDeleteSettings = "Do you want to remove " & myName & " settings as well?" & vbNewLine & _ | MsgDeleteSettings = "Do you want to remove " & myName & " settings as well?" & vbNewLine & _ | ||
"If you click No, script settings will be left in MediaMonkey.ini" | "If you click No, script settings will be left in MediaMonkey.ini" | ||
If (Not ( | If (Not (SDB.IniFile Is Nothing)) and (MsgBox(MsgDeleteSettings, vbYesNo) = vbYes) Then | ||
SDB.IniFile.DeleteSection(iniSec) | |||
End If | End If | ||
</source> | </source> |
Revision as of 18:54, 31 October 2007
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
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
[Execute]
File={app}\scripts\auto\Sample Option Sheets.vbs
Function=OnStartup()
Sample Uninstall.ini file
[Delete]
File={app}\scripts\auto\Sample Option Sheets.vbs
[Execute]
File=Uninstall.vbs
Sample Uninstall.vbs file
myName = "Sample Script" 'Put script name here
iniSec = "SampleScript" 'Put ini section name here
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