fjsen
Posts: 10
Joined: Mon Oct 19, 2020 7:06 pm

Replacing text with a property filled in a custom action

Thu Oct 29, 2020 1:55 pm

Hi,

I'm trying to store a value got from a dialog. I'm getting a property SERVER_ADDRESS from a edit box in a dialog before starting the install process. I have a custom action linked with the Next button that calculates a value derived from that, whose name is ESCAPED_SERVER_ADDRESS. I've verified it is right because I run another custom action that shows that property in the following dialog. In the "Files and Folders" I have a "TXT Update Set" action that replaces a tag inside a file with the value contained in ESCAPED_SERVER_ADDRESS property but it always get its default value, not the one I have calculated in the custom action. I regret that you cannot access to custom property values during install process. Could it be?

What is your recommended way to perform this kinds of actions?

Best regards,

Jose

Catalin
Posts: 4082
Joined: Wed Jun 13, 2018 7:49 am

Re: Replacing text with a property filled in a custom action

Thu Oct 29, 2020 7:37 pm

Hello Jose,

I have tested this and everything worked as expected on my machine.

In order for me to further investigate this, could you please forward me the following resources:

- a copy of your .AIP file

- a download link for your setup

by e-mail at support at advancedinstaller dot com?

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

fjsen
Posts: 10
Joined: Mon Oct 19, 2020 7:06 pm

Re: Replacing text with a property filled in a custom action

Tue Mar 16, 2021 12:02 am

Hi Catalin,

Sorry for the late reply.

I've just sent you a sample installer project where you can reproduce the issue.

Hope I've made some kind of mistake so I can fix it with your instructions :-)

Best regards,

Jose

Catalin
Posts: 4082
Joined: Wed Jun 13, 2018 7:49 am

Re: Replacing text with a property filled in a custom action

Thu Mar 18, 2021 4:25 pm

Hello Jose,

Thank you for the provided files.
Hope I've made some kind of mistake so I can fix it with your instructions
This is, indeed, the case here. :)

In your project, I have noticed you have used a "private property". Windows Installer properties are of two types:

- private --> contains both uppercase and lowercase characters --> e.g. Escaped_Dir

- public --> contains only uppercase characters --> e.g. ESCAPED_DIR

The difference between them consists of the fact that public properties' values are only available during the Wizard Dialogs Stage. Their values are not transfered to the "Install Execution Stage".

In our case, the property is correctly set, but its' value is not transfered to the "Install Execution Stage", where the "Text File Update" operation takes place.

For more information about this, please have a look over the "Windows Installer Properties" article.

Now, in order to fix this, please proceed as it follows:

- open your project

- go to "Files and Folders" page

- double click on the "Text File Update" --> "Replace" --> remove the [Escaped_Dir] and replace it with something temporary (e.g. any random string)

- go to "Install Parameters" page, double click on your property and change its' name from Escaped_Dir to ESCAPED_DIR

- go to "Custom Actions" page and do the same as above in your custom action (i.e. replace Escaped_Dir with ESCAPED_DIR)

- go back to "Files and Folders" page --> double click on the "Text File Update" --> replace the temporary string we've used earlier with [ESCAPED_DIR]

This way, your file should be updated accordingly.

Hope this helps!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

fjsen
Posts: 10
Joined: Mon Oct 19, 2020 7:06 pm

Re: Replacing text with a property filled in a custom action

Thu Mar 18, 2021 11:54 pm

Hi Catalin,

Thank you very much for your support. I've fixed the issue following the steps you mentioned and now it works :) (I didn't know anything related with private and public properties)

I've found a minor issue related with the escaped path. I've seen that the update text file action misses the last backslash (\) so, as a workaround, I've added one after (INSTALLDIR) text. I'm sure the ESCAPED_DIR is fine because I make a MsgBox in the custom action after the escape process.

Have you seen this issue in the sample project?

Kind regards,

Jose

Catalin
Posts: 4082
Joined: Wed Jun 13, 2018 7:49 am

Re: Replacing text with a property filled in a custom action

Mon Mar 22, 2021 8:01 pm

Hello Jose,

Thank you for your followup on this!

You are always welcome! I am glad everything works as expected now. :)

Regarding the missing "\" character, I did not notice it and I still do not quite notice it. Here is how the path looks on my machine:

Code: Select all

"SamplePath"="file:///C:\\Program Files (x86)\\My Company\\Sample1 Installer\\DiffMark.gif"
The path looks fine just fine to me. Would you expect the path to look like this?

Code: Select all

"SamplePath"="file:///C:\\Program Files (x86)\\My Company\\Sample1 Installer\\DiffMark.gif\"
Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

fjsen
Posts: 10
Joined: Mon Oct 19, 2020 7:06 pm

Re: Replacing text with a property filled in a custom action

Mon Mar 22, 2021 10:27 pm

Hi Catalin,

I've seen that the sample project I've attached doesn't reproduce the problem with the final backslash.

In our software installer, when the .reg file is updated, the installer misses the last escaped backslash, so, the escaped path to the files appears as

Code: Select all

"file:///C:\\Program Files (x86)\\Sample1\DiffMark.gif"
instead of

Code: Select all

"file:///C:\\Program Files (x86)\\Sample1\\DiffMark.gif"
So, I've added an extra backslash in .reg file, so it now contains something like

Code: Select all

"file:///(INSTALLDIR)\DiffMark.gif"
instead of

Code: Select all

"file:///(INSTALLDIR)DiffMark.gif"
In case you need more information, I can prepare another sample project derived from our software installer.

Kind regards,

Jose

Catalin
Posts: 4082
Joined: Wed Jun 13, 2018 7:49 am

Re: Replacing text with a property filled in a custom action

Tue Mar 23, 2021 2:13 pm

Hello Jose,

This is quite interesting, indeed.

First of all, I am glad you found a workaround for this.

If you'd like me to further investigate this, then yes, please forward me a sample project that reproduces it, by e-mail at support at advancedinstaller dot com.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

fjsen
Posts: 10
Joined: Mon Oct 19, 2020 7:06 pm

Re: Replacing text with a property filled in a custom action

Wed Mar 24, 2021 12:24 am

Sent!

Best regards,

Jose

Catalin
Posts: 4082
Joined: Wed Jun 13, 2018 7:49 am

Re: Replacing text with a property filled in a custom action

Tue Mar 30, 2021 3:24 pm

Hello Jose,

Thank you for the provided files.

I've done some tests and I was indeed able to reproduce the described behavior.

Having a look over the log file, I found the following lines:

Code: Select all

MSI (c) (60:68) [06:51:11:654]: PROPERTY CHANGE: Modifying ESCAPED_DIR property. Its current value is 'C:\\Program Files (x86)\\Visure Solutions, Inc\\Visure Requirements ALM 6 Client\\'. Its new value: 'C:\\Program Files (x86)\\My Company\\Sample2\'.
After that, when switching to server (when the user presses "Install"):

Code: Select all

MSI (c) (60:68) [06:51:11:769]: Switching to server: APPDIR="C:\Program Files (x86)\My Company\Sample2" ESCAPED_DIR="C:\\Program Files (x86)\\My Company\\Sample2\"
The ESCAPED_DIR property has the previously set value, without the escaped "\" at the end.

To be fully honest with you, this does not seem to be something related to your project, but rather something that the Windows Installer does. Unfortunately, I can not really say what the reason behind this behavior is.

I am glad, however, that you have found a workaround for this.

Please let me know if there is anything else I could help you with and I will be glad to assist.

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

fjsen
Posts: 10
Joined: Mon Oct 19, 2020 7:06 pm

Re: Replacing text with a property filled in a custom action

Mon Apr 05, 2021 3:45 pm

Hi Catalin,

Unfortunately the workaround is not working always. I will try another one.

Perhaps you should add this weird behaviour to your identified bugs database, in order to be fixed in a future release, in case the bug is in your side :-)

Kind regards,

Jose

Catalin
Posts: 4082
Joined: Wed Jun 13, 2018 7:49 am

Re: Replacing text with a property filled in a custom action

Tue Apr 06, 2021 2:06 pm

Hello Jose,

I have forwarded this to our development team for further investigations.

I will let you know by updating this thread as soon as I will have any useful information/the issue will be fixed (if it is indeed an issue on our side).

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

fjsen
Posts: 10
Joined: Mon Oct 19, 2020 7:06 pm

Re: Replacing text with a property filled in a custom action

Wed Apr 07, 2021 8:54 pm

Thank you very much!

Jose

Catalin
Posts: 4082
Joined: Wed Jun 13, 2018 7:49 am

Re: Replacing text with a property filled in a custom action

Thu Apr 08, 2021 12:27 pm

You are always welcome, Jose!

Best regards,
Catalin
Catalin Gheorghe - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”