Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How to use the Environment Variable %PUBLIC%


3 replies to this topic

balaji4u

balaji4u
  • Full Members
  • 74 posts

Posted 08 April 2011 - 09:59

Hi.

I am using IS2010 and my project type is Basic MSI , i want to install some files in
C:\Users\Public on a windows7 machine which resolves to environment variable %PUBLIC%. IS doesn't support this variable , how can i use it ?...Please let me know the solution for this. I dont want to use hardcoded paths as the installer will be used across different OS languages so i want to use the Env variable, so please suggest.

Regards,
Balaji

MSIYER

MSIYER
  • Full Members
  • 90 posts

Posted 08 April 2011 - 13:26

One possible algorithm:
1) Create a public property PUBLIC_FOLDER
2) Set the component's destination as PUBLIC_FOLDER
3) Create a CA
4) Fetch the value stored in USERPROFILE with MsiGetProperty()
5) Manipulate the value using ParsePath()
6) Assign this manipulated value to PUBLIC_FOLDER with MsiSetProperty()

Your component should be installed properly now. Be careful where you place this CA. It should be executed much before CopyFiles. Better to place it around Standard actions like CostInitialize or such.

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 08 April 2011 - 17:51

1. Define some default location for the file (you need this anyway for the source disk layout).
2. Right click the folder in Files and Folders view to see the MSI identifier for this folder.
3. Add a custom action, type "set a property" to set the property from step 2. to the value [%PUBLIC] (note only one % at the beginning, none at the end). This will resolve to the environment value at runtime.
4. Insert the custom action in both, the UI and the Execute sequence, before CostInitialize.
5. You may want to add condition [%PUBLIC] so these actions will only be executed if the environemnt value isn't empty.

balaji4u

balaji4u
  • Full Members
  • 74 posts

Posted 09 April 2011 - 15:37

Hi ,

Thanks for your replies, i will try both of them and will let you know the results..

Regards,
balaji