installer scripting Settings operation
-
Hi,
I want to remove windows registry keys using the qt installer framework, while uninstalling?
Does anyone succeeded in removing a settings key from the (registry in windows) using the Settings operation in component script?I've used:
[code]
component.addOperation("Execute", "cmd /C echo do nothing", "UNDOEXECUTE", "cmd /C @TargetDir@\CleanWindowsRegistry.bat /f");
[/code]where CleanWindowsRegistry.bat consists of
[code] reg delete HKEY_CURRENT_USER\Software\SugarTrumpet\player /f [/code]This works for administrator user but if the uninstaller is used from standard windows user the bat is executed with administrator privileges and does not removes the registry folder.
I think much cleaner, multi-platform, way is to use the Settings operation,
something like [code] component.addOperation("Settings", "HKEY_CURRENT_USER\Software\SugarTrumpet", "remove", "player", "0"); [/code]
But it's not working.Except the ifw manual, I can't find more detailed information or any example about the operations and possible argument in component scrip?
Everything best, Goran.
-
Hi,
finally I found a solution :)
Instead of using the component, in the controller script constructor i connected the "uninstallationStarted" signal:[code]
function Controller()
{
// default constructor
installer.uninstallationStarted.connect(onUninstallationStarted);
}onUninstallationStarted = function()
{
installer.performOperation("Execute", "cmd /C reg delete HKEY_CURRENT_USER\Software\SugarTrumpet\player /f");
}[/code]
So the performed operation ("deleting the registry key") is executed at the very beginning of uninstallation process with currently logged user credentials. After that the uninstaller asks for administrators permission and continues the un-installation process as under administrator.
Everything bets, Goran. -
@GoranShekerov
Tried the above code to stop and remove the windows service while uninstalling from QT installer. But did not workfunction Controller()
{
installer.uninstallationStarted.connect(onUninstallationStarted);
}onUninstallationStarted = function()
{
if (installer.isUninstaller()) {
installer.performOperation("Execute", "@TargetDir@/platform/tools/Server/testServer.exe", "stop");
console.log("Server stopped")
installer.performOperation("Execute", "@TargetDir@/platform/tools/Server/testServer.exe", "remove");
console.log("Server removed")
}
}