Run a batch script before uninstallation using QT Installer Framework

418 views Asked by At

I have a batch script that does some clean up, which is installed along the main application. However, I cannot seem to execute the batch file before uninstallation. Here is my install script:

function Component() {

}

function Controller() {
    installer.setDefaultPageVisible(QTInstaller.TargetDirectory, false);
}

Controller.prototype.uninstallationStartedFunction = function() {
    if(systemInfo.productType == "windows") {
        installer.gainAdminRights();
        installer.execute(installer.value("TargetDir") + "/disable.bat");
    }
}

Any help is appreciated.

1

There are 1 answers

1
Harut On

It depends if this is your component script or controller script. You can use the controller script and should connect to the installer signals handle to have a callback function to execute if the uninstallation is running. For example

function Controller() {
   installer.uninstallationStarted.connect(this,Component.prototype.onUninstallationStarted);
}

Component.prototype.onUninstallationStarted = function()
{
   // do your stuff
}