Component.prototype.createOperations = function()
{
try {
// call the base create operations function
component.createOperations();
// Add some keys to registry;
var userProfile = installer.environmentVariable("USERPROFILE");
installer.setValue("UserProfile", userProfile);
var reg = installer.environmentVariable("SystemRoot") + "\\System32\\reg.exe";
var key= "HKCU\\Software\\Company\\Product";
component.addOperation("Execute", reg, "ADD", key, "/f");
component.addOperation("Execute", reg, "ADD", key, "/v", "productId", "/t", "REG_BINARY");
// Add a desktop shortcut with icon:
component.addOperation("CreateShortcut", "@TargetDir@\\MyExecutable.exe", "@UserProfile@\\Desktop\\MyExecutable.lnk",
"workingDirectory=@TargetDir@", "iconPath=@TargetDir@\\MyIcon.ico");
} catch (e) {
print(e);
}
}
Component.prototype.createOperations = function()
{
try {
// call the base create operations function
component.createOperations();
// Add some keys to registry;
var userProfile = installer.environmentVariable("USERPROFILE");
installer.setValue("UserProfile", userProfile);
var reg = installer.environmentVariable("SystemRoot") + "\\System32\\reg.exe";
var key= "HKCU\\Software\\Company\\Product";
component.addOperation("Execute", reg, "ADD", key, "/f");
component.addOperation("Execute", reg, "ADD", key, "/v", "productId", "/t", "REG_BINARY");
// Add a desktop shortcut with icon:
component.addOperation("CreateShortcut", "@TargetDir@\\MyExecutable.exe", "@UserProfile@\\Desktop\\MyExecutable.lnk",
"workingDirectory=@TargetDir@", "iconPath=@TargetDir@\\MyIcon.ico");
} catch (e) {
print(e);
}
}
To copy to clipboard, switch view to plain text mode
All right, but another key I need to write into registry is the package VERSION NUMBER, defined in the installer configuration file config.xml in tag <Version></Version>
Bookmarks