cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
NORTALF
Level 3

How to specify INSTALLDIR that uses other property?

In Product Properties I have
Name: Prod222
...
INSTALLDIR: [ProgramFilesFolder][ProductName]

I expect INSTALLDIR to be C:\Program Files\Prod222
but I get this: C:\Program Files\[ProductName]

Is there any way to use ProductName as a varible in INSTALLDIR path construction?
Labels (1)
0 Kudos
(2) Replies
thepeter
Level 7

ProductName is a private property and its value is reset when switching to Execute sequence. You need to have a "Set Property" custon action type and set the value ProductName as the value of INSTALLDIR.
0 Kudos
NORTALF
Level 3

Thank you for your answer.
Tell you the truth I didn't get it, it was to complex for me, I just don't have enough experience with IS.

I found good paper by Robert Dickau that explained what you ment.
This is how I used it:

Step1: Create VBScript CA:
--------------------------
Custom Actions and Sequences
|
V
Right-click Custom Action
|
V
select "New VBScript"
|
V
"Stored in custom action"

Name custom action MyCA

Step2: Modify Common tab values:
---------------------------------
Return Processing: Synchronous (check exit code)
In-Script Execution: Deferred Execution
...
Install Exec Sequence: After CreateFolders
Install Exec Condition: Not Installed

Step3: Script Tab, add script:
-----------------------------

'Set environment variables
Option Explicit
Dim WshShell
Set WshShell = CreateObject("wscript.Shell")

'Retrieve list of properties that this CA uses
'Note: CustomActionData is very importent!!!
Dim strProperties
Dim arrProperties
strProperties = Session.Property("CustomActionData")

'Split list to individual properties
arrProperties = Split(strProperties, ";")

Dim SupportDir
Dim InstallDir
SupportDir = arrProperties(0)
InstallDir = arrProperties(1)

.....

This is what script uses and here is solution how to get these properties:
Step 4: Create SetProperty Custom Action:
-----------------------------------------
Custom Actions and Sequences
|
V
Right-click Custom Action
|
V
"New Set Property"

Step 5:This is the tricky part, Modify Cummon Tab:
-------------------------------------------------
Property Name: MyCA
Property Value: [SOURCEDIR];[INSTALLDIR]
...
Install Exec Sequence: After InstallInitialize
Install Exec Condition: Not Installed

Note that "Property Name" is exactly the same as your VBScript Custom Action and "Property Value" has all the properties you want to use delimeted with ";"

Hope it helps other people that try to do the same 🙂
0 Kudos