This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- Re: Dynamic installation path
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Oct 30, 2013
10:19 AM
Dynamic installation path
Hello.
Is it possible to install my software to a folder/path which name is dynamic?
It changes according to a variable defined and stored in a custom dialog textbox.
For example, I want to install to the path "C:\company\software [VARIABLE]".
Thanks in advance.
Is it possible to install my software to a folder/path which name is dynamic?
It changes according to a variable defined and stored in a custom dialog textbox.
For example, I want to install to the path "C:\company\software [VARIABLE]".
Thanks in advance.
(4) Replies
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 06, 2013
02:36 PM
On the dialog where the user is setting the VARIABLE property, you can add an event to update INSTALLDIR
Event= [INSTALLDIR]
Argument= C:\company\software [VARIABLE] (do not use quotes)
Condition=1
Event= [INSTALLDIR]
Argument= C:\company\software [VARIABLE] (do not use quotes)
Condition=1
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 06, 2013
05:54 PM
Depending on the project type and your installer design you will need to do different things.
I have the need to have one or many install paths in my installations. Most of these are not changeable by the user but are not known until runtime.
I search for some registry values and set the paths once found. In your case, instead of searching for values, you would set values that the user provides.
In general here is what I do:
I create a new root folder in the folder list. This folder is something logically named and at the same level as INSTALLDIR and all the other predefined locations.
I then add components to static paths below this folder. For example bin or tools. Remember the user is only setting the parent location and not dictating how your files are deployed.
When I know the location at runtime, I set the folder location in one of two ways (depending on project type)
Method 1: Basic MSI: Use a Set Directory CA.
This is usually very strait forward so long as you understand the scheduling involved.
Scheduling is really fancy way of saying "in what order should this action happen relative to all the other actions in the installer".
A sequence is a group of actions that are scheduled to run during different modes of operation of your install. There are 3 modes or sequences, UI, Execution, and Advertise.
I don't do much with advertise so I can't offer any insight there but the default way a user would run your installer is in the UI sequence (double click on setup.exe and go to town)
In this mode you could schedule the set directory action to happen just before you transitioned to the execute sequence.
The Execute sequence should also be considered if you want to support silent installs.
Since a silent install will not display any UI, the UI Sequence is not run at all thus skipping your set directory CA.
You should come up with a default value in these cases so that the install path is meaningful.
Method 2: InstallScript MSI projects
This method is also sorta easy but it is a little less elegant.
Once you know your INSTALLDIR, in the OnFirstUIBefore function, you can call MsiSetTargetPath(ISMSI_HANDLE, "logical name from directory table", PathValueVariable or Literal);
Hope this helps.
I have the need to have one or many install paths in my installations. Most of these are not changeable by the user but are not known until runtime.
I search for some registry values and set the paths once found. In your case, instead of searching for values, you would set values that the user provides.
In general here is what I do:
I create a new root folder in the folder list. This folder is something logically named and at the same level as INSTALLDIR and all the other predefined locations.
I then add components to static paths below this folder. For example bin or tools. Remember the user is only setting the parent location and not dictating how your files are deployed.
When I know the location at runtime, I set the folder location in one of two ways (depending on project type)
Method 1: Basic MSI: Use a Set Directory CA.
This is usually very strait forward so long as you understand the scheduling involved.
Scheduling is really fancy way of saying "in what order should this action happen relative to all the other actions in the installer".
A sequence is a group of actions that are scheduled to run during different modes of operation of your install. There are 3 modes or sequences, UI, Execution, and Advertise.
I don't do much with advertise so I can't offer any insight there but the default way a user would run your installer is in the UI sequence (double click on setup.exe and go to town)
In this mode you could schedule the set directory action to happen just before you transitioned to the execute sequence.
The Execute sequence should also be considered if you want to support silent installs.
Since a silent install will not display any UI, the UI Sequence is not run at all thus skipping your set directory CA.
You should come up with a default value in these cases so that the install path is meaningful.
Method 2: InstallScript MSI projects
This method is also sorta easy but it is a little less elegant.
Once you know your INSTALLDIR, in the OnFirstUIBefore function, you can call MsiSetTargetPath(ISMSI_HANDLE, "logical name from directory table", PathValueVariable or Literal);
Hope this helps.
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 10, 2013
08:52 AM
I used InstallScript code in a Custom Action. Sequence it before files are installed. Also, I define my LICENSE_DIR as he described above
export function SetLicenseDirectory(HWD);
function SetLicenseDirectory ()
STRING szBase;
begin
szBase = UpdateBaseDirectory(INSTALLDIR);
MsiSetProperty(ISMSI_HANDLE, "LICENSE_DIR", szBase^"License");
end;
/*---------------------------------------------------------------------------*\
* function UpdateBaseDirectory(STRING)
*
\*---------------------------------------------------------------------------*/
function STRING UpdateBaseDirectory (tgtDir)
STRING baseDir;
NUMBER pos;
NUMBER lastPos;
begin
// first, find out if the last characther in the string
// is a backslash
baseDir = tgtDir;
StrRemoveLastSlash ( baseDir );
pos = StrFindEx(baseDir, "\\", 0);
if (pos < 0) then
return (baseDir);
endif;
lastPos = pos;
while (pos >= 0)
pos = StrFindEx(baseDir, "\\", pos + 1);
if pos > 0 then
lastPos = pos;
endif;
endwhile;
StrSub(baseDir, baseDir, 0, lastPos);
return(baseDir);
end;
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
‎Dec 13, 2013
01:13 AM
What do you mean by static and dynamic pages? Im sorry Im quite new to this. All I know is that you should have fresh content on a regular basis on your blogs to have better google ranking.
![](/skins/images/8CE4FAD0DE6F3A6F9D0567434D2D2DAE/responsive_peak/images/icon_anonymous_message.png)