Shortcut customization hell


#1

Hello,

I’m currently updating an existing PB3 x86-only project to be able to build both x86 and x86-64 installers. Everything went fine until reaching the shortcuts step.

In our PB3 project, I used to create shortcuts through the IDE (Create shortcuts menu) and it went fine (that was the easiest way).

Here is what I’m trying to get:

  1. When installing x86 packages on Windows 32-bit or x86-64 packages on Windows 64-bit:
    • Program group name: “MyGroup”
    • Shortcut name: “MyShortcut”
  2. When installing x86 packages on Windows 64-bit:
    • Program group name: “MyGroup (x86)”
    • Shortcut name: “MyShortcut (x86)”

So I decided to create an %ARCH_SUFFIX% custom variable whose value is empty in case 1 and " (x86)" in case 2.

Here are the issues encountered trying to do so in the “Create shortcuts” menu:

  1. I cannot use that custom %ARCH_SUFFIX% variable in the “Default Start Menu Folder Name” field: only predefined variables like %APPTITLE% seems to be replaced at run time, %ARCH_SUFFIX% remains unresolved in the resulting string. I think it is the same when using this variable in the Shortcut Filename. Is this a bug?
  2. I cannot create a variable with an empty value. Is this a bug?
  3. I cannot create a variable with a value starting with a space. The leading space is removed at runtime and sometimes appears in the custom action events, sometimes not. Is this a bug?

Then I tried to do it with the “Create a folder” + “Create a shortcut (.lnk)” custom actions. This resolves issue 1 from the previous case, but issues 2 & 3 are still blocking.
Moreover, shortcuts created through the custom action are not removed by the uninstaller, unlike stated in the documentation. Am I missing something here?

Thanks for your help.


#2

Thank you for your detailed feedback. We could use it to fix some of your reported problems in Paquet Builder 2018.

It’s because the variable that holds the text from the “Default Start Menu Folder Name” field is created right before the Initialization variable.
This variable is named %SHORTCUTPATH% and you can modify it yourself later. This should fix your problem.

Both problems were fixed in PB 2018. The empty value problem is something we wanted to fix a long time ago.


#3

Hello,

i have installed Paquet Builder 2018 and tried one more time. Here is the feedback for the 3 issues I reported:

  1. This worked perfectly using %SHORTCUTPATH% as you said. For no reason, I considered it as read-only.
  2. No more error when setting a variable to an empty value -> issue solved, thanks.
  3. I still don’t manage to set a variable to a value starting with a space. Am I missing something obvious here? It seems to work when I edit the custom action, you can see the leading space in the displayed custom action. But if you save the project, quit and open the project again, even if the leading space is still displayed visually in the custom action, it is removed when you edit the custom action again or install the package.

#4

Strange, it does work for us in PB 2018. Could you copy and paste the custom action’s XML here? Just click Copy to clipboard to copy the CA and paste the text here.


#5

Sure.

This is the CA right after its creation:

<?xml version="1.0" encoding="utf-8"?>

TModVarInfoSet “%ARCH_SUFFIX%” to this value " (x86)"10 (x86)%ARCH_SUFFIX%

And this is the same one after saving, closing, reopening the project:

<?xml version="1.0" encoding="utf-8"?>

TModVarInfoSet “%ARCH_SUFFIX%” to this value " (x86)"10(x86)%ARCH_SUFFIX%

Then finally after editing the CA then closing the CA without changing anything:

<?xml version="1.0" encoding="utf-8"?>

TModVarInfoSet “%ARCH_SUFFIX%” to this value "(x86)"10(x86)%ARCH_SUFFIX%