How do you find the user-selected install path in Inno Setup? - inno-setup

I need to get the path that the user chose to install my application into.
If I set CreateAppDir=yes and set a DefaultDirName=C:\MyApp\ the user can change it to some other directory. After they do this, I need to know which directory they chose on the next install wizard step. How can I get this value?

Use the {app} constant. The reference describes it as:
The application directory, which the user selects on the Select
Destination Location page of the wizard. For example: If you used
{app}\MYPROG.EXE on an entry and the user selected "C:\MYPROG" as the
application directory, Setup will translate it to
"C:\MYPROG\MYPROG.EXE".
Optionally you can use the WizardDirValue function. This one is described as:
Returns the current contents of the edit control on the Select
Destination Location page of the wizard.
Unlike ExpandConstant('{app}'), this function will not fail if called
after the wizard is shown but prior to the user selecting a directory.
Rather, it will return the default directory name.

Related

how to "save" a file/folder in the Node.js app "Universal GUI"

I can't figure out how to add a "save file/folder" input to Universal GUI.
I need to be able to pick a location to pass as a file or folder
to the cli program without the file/folder in question existing already.
Selecting a pre-existing file to pass to the cli command is easy, just use the generic file upload entry.
And Universal GUI already has a "select folder" entry.
Both options require selecting one that already exists.
So all I need is to be able to select a file and/or folder that doesn't exist in a "save" form.
I've never found an alternative to NW.js that doesn't require manually setting up the Node.js launcher.
So that's what I run the app I made in/for Universal GUI.
The folder browser is designed to allow you to select existing folders or create new ones. File select will also allow you to create new files.
It sounds like what you want is to use the folder selector, so the user can select the folder (or create it, then select it) as their output directory. Then give them an input text field to type a file name into. Then you just combine all of that together as an argument for the CLI.
<cmd executable="myexe">
<arg>--save "((outputDirectory))\((fileName)).txt"</arg>
</cmd>
<!--
What would be sent to the command line:
myexe --save "C:\Users\Bob\Desktop\SomeFolder\MyFile.txt"
-->

Installshield - Merge Module - Dynamic destination directory based on user dialog input

I am trying to set the override the destination directory of the merge module as described here. I set the destination directory to [BIN]. BIN is public property. At compile time the value of [BIN] is C:\Program Files (x86)\CompanyName\ProductName.
Based on the user input in a custom dialog, this property is updated to C:\Program Files (x86)\CompanyName\UserInputName\ProductName.
All the DLL files from the merge module are copied into the compile-time value of [BIN] - C:\Program Files (x86)\CompanyName\ProductName. For some reason, the dynamic value is ignored in this case.
Can someone tell me what could be going wrong?
I am using Install Shield Version 2010 Professional Edition, Project Type is Basic MSI Project
Merge Modules add a GUID to every primary key to prevent merge collisions. So the BIN identifier actually turns into BIN.G_U_I_D when used in a Merge Module.
To resolve this issue, Merge Modules are designed to be "retargetable".
I have posted the same question on InstallShield forum, the conclusion there was it is not supported by InstallShield to change destination directory of an MSM file during run time.
A workaround suggested is to have a custom action 'Set Directory'.
Here are the steps:
In the Redistributable view, right click on the MSM file ->
Properties -> Destination -> set to [MSM_DEST_STATIC_DIR].
Create a custom action of type'Set Directory', with Directory Name -
MSM_DEST_STATIC_DIR, Directory Value - [MSD_DEST_DIR_DYNAMIC_VALUE]
After getting the user input from the dialog, first, update the MSD_DEST_DIR_DYNAMIC_VALUE, then execute the custom action created in step 2.
While doing this I also realized that it is not possible to update the IISROOTFOLDER based on the dynamic user input. I followed the same procedure with the custom action to update the IISROOTFOLDER.

How can I use a dialog to define the program group name in Installshield 2015

I am currently trying to expand our installation program with an option for the user to specify the name of the program group where shortcuts are created under the start menu. (I am aware that this is a somewhat outdated concept)
I am using InstallShield 2015.
I created a localizable property named [PROGRAMGROUP_NAME]. This has automatically created an {ID_STRING46} which I've set to the desired default value. So far so good.
I managed to create a custom dialog with an edit control, which is linked to the above property.
Now comes the tricky part: Under Shortcuts, under "Programs Menu" I first want to add a folder with the program group name, under which to place several shortcuts.
If I enter [PROGRAMGROUP_NAME] that is literally what the name becomes. If I use {ID_STRING46}, it uses the default value, and not what I've entered in the dialog.
Incidentally, when I tried to rename ID_STRING46 to something more meaningful, other things started going wrong so I've left that as is.
What is going wrong here? How do I get the value of the property to be used for the folder name?
EDIT
I am trying to use a custom action now, but I have trouble defining it. My Dialog that sets the property is after CostFinalize, so I assume I have to use SetDirectory - but I have trouble defining it. I get an error stating "could not access network location "
EDIT
I've managed to progress a step. I have manually added a directory with key DIRECTORY_PROGRAM_GROUP (important that it's all caps to make it public) to the directory table. Then, I use a custom action to set that directory to the desired value [ProgramMenuFolder][PROGRAM_GROUP_NAME] after I've run my dialog, and I've modified the shortcut to be created in that folder.
Seems to work great, however, now the program group is no longer removed when uninstalling...
Shortcuts are installed to folders, and the name of the folders below ProgramMenuFolder become the program group as you describe it. So you will need to either build up the Directory table (either directly---note that the DefaultDir column is localizable, and there may already be a string you can update---or through the Files and Folders view) to do what you want, or use custom actions (set property, if before costing; set directory, if after costing) to adjust the location to which your shortcut is installed.
As for the problems renaming ID_STRING46, odds are you didn't update a reference after you changed the name of the string. The simplest way to track down where these are may be to examine differences in the built installer (perhaps using InstallShield's MSI Diff) and then update the relevant references using the direct editor if you can't find them in the normal views.

InnoSetup tries to Create DefaultDir in any case

I created an installer with innosetup to install an application that consists of two executables. Each of them should go to a separate folder. So I created a custom InputDirPage using the "CreateInputDirPage" function and added two entries to this page, one for each executable
To prevent the default DirPage from showing up I used these parameters in the [Setup} section:
DisableDirPage = yes AND AlwaysShowDirOnReadyPage= no
I wrote functions to extract the Folder paths from my custom DirPage and
this works fine and evrything ends up where it is supposed to be.
BUT: During the installation process Innosetup tries to create the folder set in the DefaultDirName as this folder is the value in the invisible DirPage.
If that folder does not exists and one would need administrator rights to create that folder, the setup will crash.
I worked around that problem by setting DefaultDirName = {pf} in the [Setup] section.
(As the program folder does always exist, I do not get any error messsage for failed creation attempts that way)
Now my questions are these:
Is there a setup parameter that tells Innosetup to completely ignore
the content of the wizard dir page? Because making it invisble seems
no to be sufficient.
Can I set that content or the {app} constant at runtime to avoid the "DefaultDirName" folder from being created?
Yes, there is an option called CreateAppDir.
[Setup]
CreateAppDir=No

How to set the install path of a merge module from a registry key?

I have created an installer (using InstallShield 2012 Spring) that consumes a merge module that I created and I want to install the files from both the main installer and the merge module to a path that is stored in the registry. In a separate installer the user is able to specify the install location and I save this path in the registry to be used by subsequent installers.
In the merge module my components have a desination of 'INSTALLDIR\Folder'. In the main installer I have changed the Destination property in the Redistributables pane from '(User merge module's default destination)' to 'INSTALLDIR'. This allows me to install the merge module's files to the same path that is in the main installer when the installer is built, but if I change the Destination during run time (through custom action or the DestinationFolder dialog) only the main installer's files are installed to the desired path.
I am using an system search to retrieve the path from the registry and store it in a property. Then I have a custom action that sets INSTALLDIR to the path that is read from the registry.
If I go to the direct editor of the merge module and edit the Directory table I can change INSTALLDIR.GUID to INSTALLDIR and I get my desired results however this causes the 'Components' and 'Files and Folders' panes to be unusable.
Is there a better way to do this?
I saw these answers and they got me started but I can't seem to get the Merge Module's destination to change during run time.
Installshield 12: Changing the destination of a merge module at run time
Make installshield merge module installation path configurable for user
I ran into a similar situation. If you remove the GUID from the INSTALLDIR values only in the Directory_Parent column, then the Files and Folders, etc, panels become unusable. You need to be sure that you remove the GUID from the INSTALLDIR cell in the Directory column as well. Then the merge module will 'inherit' the INSTALLDIR of the parent installer and the directories you've created in your merge module will inherit from that.

Resources