Conditional text update or string replacement - Advanced Installer Community
litu
Posts: 71
Joined: Fri Mar 22, 2013 2:57 pm

Conditional text update or string replacement

Hi,

Here's the scenario: We have two types of customers, the ones who trust us and have all their data in our servers and the ones who has their own servers.
We have developed an application that is installed on the servers.
We have developed a WebService that will be installed on the servers.
We have developed a program to be installed on the clients attacking our servers or their own servers (depending on the type of client).

To know the URL of the web service, I added a dialog that asks the user the URL of the application; if it's our server, I have to write on the configuration XML some value, text update and that's it. If it's the customer server, the user input will be http://customerserver/application and this string will be stored in a property. But I need to write http://customerserver/WebService on the configuration XML.

Is there a way to change the text update based on a condition?
Is there a way to replace that part of the property string? (based on a condition also).

Thanks in advance,
Arnau.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Conditional text update or string replacement

Hello Arnau,
Is there a way to change the text update based on a condition?
For this you can use Windows Installer properties inside your text file update. In order to change their value, you can use the predefined Set installer property custom action. You can condition the execution of the custom action through its condition field, based on your scenario.
Is there a way to replace that part of the property string? (based on a condition also).
In order to achieve this, you can create a custom action. For example, you can create your custom action as a custom action written in C# or a custom action written in C++.

Then you can go in the “Custom Actions” page and add a predefined Launch attached file custom action with sequence. This type of custom action can execute an application (EXE or DLL) or run a script (VBScript or Java script). Also, the source file will be embedded in the MSI file but will not be deployed at install time with the other application files.

If you are using the VBScipt approach, in order to take the property value in a variable, you can use the the following statement:

Code: Select all

value = Session.Property("My_Prop") 
So, the Session.Property is a read-write property that represents the string value of a named installer property .
Using the script approach can also be implemented with the Execute inline script predefined custom action with sequence. Edit the “Script text” with the body of the script.

Please let us know if that helped, otherwise give us more details.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
litu
Posts: 71
Joined: Fri Mar 22, 2013 2:57 pm

Re: Conditional text update or string replacement

Hi,

Thanks alot for your answer. I was hopping that there was a way to modify the string in the property without CustomActions.

Kind regards,
Arnau.
Dan
Posts: 4530
Joined: Wed Apr 24, 2013 3:51 pm

Re: Conditional text update or string replacement

You're welcome Arnau,

If there is anything else I can help you with, please let me know.

Best regards,
Dan
Dan Ghiorghita - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Common Problems”