cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 
georgiy_senenko
Level 5

Set properties in InstalLScript project

Hello,

In my InstallScript project particular value is used in many places (e.g. shortcut name, exe file name) and I would like define property/variable in some place in order that modifications would affect all corresponding places.

I tried to define Property in Direct Editor as MyProperty (value for example is "abcd").
Then used it as [MyProperty] or in shortcuts, but it was presented as [MyProperty] or . I would like to have it as "abcd".

Could you please advise how to solve this problem?

Thank you in advance.

Regards, Georgiy
Labels (1)
0 Kudos
(2) Replies
phill_mn
Level 7

What I do in my InstallScript projects is:
1) In Files and Folders under the Script-Variable tree, create a new script variable.
2) I also create a global variable in my code that corresponds to this script-variable just because with-in the script handles it is easier to use the global variable.
3) At some point in OnFirstUIBefore (or earlier) initalize the global variable to the path (or value) to be used. I use this for paths, web site names, server names, and port values, etc.)
4) Call FeatureSetTarget. This needs to be called prior to SdFeatureTree or any dialog which would try to use the path (such as when file costing is done for all paths).
5) Define component paths, shortcuts, XML strings ct. to use the path. In most cases you can select the defined variable in the IDE for a target path, but in a shortcut name you might need to use the [] syntax.
6) The value of the script-defined var is persisted in the log as indicated by log viewer tool.
0 Kudos
phill_mn
Level 7

When you create a script-defined var in Files and Folders, by default the name is "". The "<" and ">" are part of the name unless you change it. When you use the string in a path (of a shortcut or component) it would be "\folder". The same syntax is used for registry keys and XML file changes.
0 Kudos