Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Qt Installer Framework - Create shortcut in Start Menu for all users

With the installer framework I would like to create an installer for my application. The application is installed by the administrator on the PC. The application is then used by different users.

In the installer I create shortcuts from executable to start menu.

This is accomplished in the installscript.js by the command:

component.addOperation(“CreateShortcut”, “@TargetDir@/application.exe”, 
“@StartMenuDir@/Name of Application.lnk”, “workingDirectory=@TargetDir@”);

The problem now, is that the installer creates shortcut in the start menu only for the current user, e.g. the Administrator.

Also, the uninstall program is visible only for the current user. When I log with another user, the application is not visible in the start menu.

How is it possible to generate a shortcut, which is visible in the start menu for all users?

like image 492
user3793032 Avatar asked Jul 01 '14 08:07

user3793032


2 Answers

Try

component.addOperation("CreateShortcut", "@TargetDir@/application.exe", "C:\\ProgramData\\Microsoft\\Windows\\Start Menu\\Programs\\<Name of Application>.lnk");

In fact, there is a variable AllUsersStartMenuProgramsPath available but I have just tried it and it seems to be broken. Links are put in C:\ by using it.

Like installer.value("os"), you should use installer.value("AllUsersStartMenuProgramsPath") in your script.

See the lastest documentation : http://doc-snapshot.qt-project.org/qtifw-master/scripting.html

I think a bug should be opened on their bug tracker : https://bugreports.qt-project.org/secure/Dashboard.jspa

like image 166
MBach Avatar answered Oct 16 '22 11:10

MBach


This works for me:

Component.prototype.createOperations = function()
{
    component.createOperations();
    console.log("creating start menu entries");
    if (systemInfo.productType === "windows") {
        component.addOperation("Mkdir", "@StartMenuDir@")
        component.addOperation("CreateShortcut", "@TargetDir@/README.txt", 
            "@StartMenuDir@/README.lnk",
            "workingDirectory=@TargetDir@", 
            "iconPath=%SystemRoot%/system32/SHELL32.dll",
            "iconId=2", "description=Open README file");
    }
}

Note that the script creates the according start menu directory before creating the shortcuts.

like image 22
Herr von Wurst Avatar answered Oct 16 '22 12:10

Herr von Wurst