[Development] Qt Installer Framework Script

Berkay Elbir berkayelbir at gmail.com
Thu Apr 9 18:50:52 CEST 2015


Hello,

I have a question about QInstaller. How can I make the Uninstaller check
exe is running or not before uninstalling? I can do this with installing
process but I can not write correct script (installscript.qs) for
uninstalling process.

Should I write another script for Uninstaller? Actually, I managed to come
here with the examples. This is my script :

function cancelInstaller()
{
installer.setDefaultPageVisible(QInstaller.Introduction, false);
installer.setDefaultPageVisible(QInstaller.TargetDirectory, false);
installer.setDefaultPageVisible(QInstaller.ComponentSelection, false);
installer.setDefaultPageVisible(QInstaller.ReadyForInstallation, false);
installer.setDefaultPageVisible(QInstaller.StartMenuSelection, false);
installer.setDefaultPageVisible(QInstaller.PerformInstallation, false);
installer.setDefaultPageVisible(QInstaller.LicenseCheck, false);

installer.setValue("FinishedText", "Operation was canceled!");

}

function Component()
{
var programFiles = installer.environmentVariable("ProgramFiles");
if (programFiles != "")
installer.setValue("TargetDir", programFiles + "/A");

var programValid = true;if(installer.isProcessRunning("A.exe") == true)
{
    QMessageBox["warning"]("os.warning", "Installer","Program is
currently running!",QMessageBox.Ok);

    programValid = false;

}

    if (!programValid) {
    cancelInstaller();
    return;
}

}

Component.prototype.isDefault = function()
{
// select the component by default
return true;
}

Component.prototype.createOperations = function()
{
try {
// call the base create operations function
component.createOperations();
if (installer.value("os") === "win") {
component.addElevatedOperation("Execute", "{0,3010}",
"@TargetDir@\vcredist\vcredist_x86.exe",
"/norestart", "/q");
component.addOperation("CreateShortcut", "@TargetDir@/A.exe",
"@StartMenuDir@/A.lnk");
component.addOperation("CreateShortcut", "@TargetDir@/uninstall.exe",
"@StartMenuDir@/Uninstall.lnk");
component.addOperation("CreateShortcut", "@TargetDir@/A.exe", "@DesktopDir@
/A.lnk");
}
} catch (e) {
print(e);
}
}


Thanks.

Best Regards,

Berkay Elbir
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.qt-project.org/pipermail/development/attachments/20150409/511d2547/attachment.html>


More information about the Development mailing list