Editbox gives name within ApplicationFolder hierarchy - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

reo
Posts: 7
Joined: Mon Jun 07, 2010 4:42 pm

Editbox gives name within ApplicationFolder hierarchy

This is my end goal: To build a 6 level file folder hierarchy that looks like:

[Application Folder]
+ down1
| + UserEditableName
| | + down2
| | | + down3
| | | | + down4
| | | | | + (lots of files and folder)

I want to give the User the ability to change where the [Application Folder] points.
I want to give the User the ability to change the name of the Folder called "UserEditableName".
But "down1", "down2", "down3", and "down4" I want to hard code as folder names.

So I added two Install Parameters:
MY_FOLDER_name, MY_FOLDER
MY_EDIT_name, whatever

I've added a "Property Set with Formatted" to the Custom Action for the "Install UI Sequence" "Begin"
The property name is= MY_FOLDER
The formatted text= "[APPDIR] "\down1\[MY_EDIT_name]

And then I do a "Shift" Mouse drag to copy this property down to the "Begin" for an "InstallExecuteSequence".

In the Files and Folders I've added a "Property Based" NewFolder that is called = MY_FOLDER_NAME
but has value = MY_FOLDER_name
and to this I have added the regular folders "down2", "down3", "down4" inside of each other.
Inside "down4" is an "Add Folder location with refresh" that points to a lot of files that I want to install at the location of "down4".

I've also built a custom dialog that has an EditBox on it that allows the User to enter the name of that subfolder.
It is tied via the Property Name to MY_EDIT_name

When I do a "Build", all the files and folders get copied into the "Application Folder" without any folders above it.
(This kind of seems strange to me... but I am just going with it for now)

And then when "Run",
I get the dialogs to come up as expected.
The location of where to install comes up. And that interacts as expected.
The dialog comes up with the edit box for the sub folder. (It even has a default string that comes up. I change that text. Seems OK.)
And click "Next".

And then when the install finishes, the folder structure looks like:
[Application Folder]
| + (lots of files and folder)

What did I miss doing to able to get those extra levels of folder names between the "Application Folder" and all the other files and folders?
reo
Posts: 7
Joined: Mon Jun 07, 2010 4:42 pm

Re: Editbox gives name within ApplicationFolder hierarchy

I remade the project from scratch.
The strangeness of all the folders being put into the "Application Folder" has gone away.

I have also set the Custom Action for the "MY_FOLDER_name"
InstallUISequence Begin (and InstallExecuteSequence Begin) to have
Property Name: MY_FOLDER_name
Formatted Text: "[DOWN1_DIR]"\[MY_EDIT_name]
and the Execute Option: Immediate Execution

But I still get an error that the Installer cannot Run...
It tells me:

Could not access network location ""\whatever

(whatever is the default text for "MY_EDIT_name").

Any ideas what I am still doing wrong?
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Editbox gives name within ApplicationFolder hierarchy

Hello,

There are a few issues:
- property based folders should use all-upercase properties (public properties): MY_FOLDER_name should be MY_FOLDER_NAME
- the error you are receiving is because during CostInitialize - CostFinalize standard actions MY_FOLDER_NAME should contain a valid path so that required disk space for your installer can be properly computed. Set that property to some valid path before CostInitialize standard action.

I hope this helps.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/
reo
Posts: 7
Joined: Mon Jun 07, 2010 4:42 pm

Re: Editbox gives name within ApplicationFolder hierarchy

Setting the Property based folder to all upper case was a step in the right direction.
Things get past the disk space initialization phase.

But I run into other problems...

One I can fix by hard coding.
I need a custom action to set the Formatted Text for the MY_FOLDER_NAME property.
Formatted Text = [APPDIR]down1\[MY_EDIT_name]
If I use = [DOWN1_DIR][MY_EDIT_name]
then the [DOWN1_DIR] portion never seems to be evaluated and stays blank. And the space initialization fails.
If I use [APPDIR]down1\ that sems to work fine to get past the space initialization...

But when I change the location of where the application folder is when I test the install,
the files do not go to the new drive. They went to the original APPDIR location.
This seems to be due to the UserAction I was picking to resolve the MY_FOLDER_NAME in...
I tried START, but that did not seem to work.
So I have used a combination of InstallUISequence + CostInitialize and InstallExecuteSequence + Begin

And now I have some problem with uninstalling my latest test. (Gives an error about the Network folder could not be found.)
And the unistall fails.

I am in the process of downloading the Windows SDK so I can run MSIZAP.
reo
Posts: 7
Joined: Mon Jun 07, 2010 4:42 pm

Re: Editbox gives name within ApplicationFolder hierarchy

MSIZAP did remove the bad install.

And I am currently using a combination of InstallUISequence + CostInitialize and InstallExecuteSequence + CostInitialize
to set the Formatted Text [APPDIR]down1\[MY_EDIT_name]
for the PropertySource with PropertyName MY_FOLDER_NAME.

But when I test my build and if I change the location of where the APPDIR points (using the FolderDlg that comes up) to say "Z:\",
then what is created is:

Z:\down1 (and nothing else is put in here)
C:\Program Files\down1\(default text for the MY_EDIT_name)\down2\down3\down4\lots of files and folders


This is some good progress but not quite what I am looking for yet.

In the CustomActions is there some special place/way I need to set which InstallUISequence and InstallExecuteSequence items
I need to associate the evalution of the Formatted text such that
1) folders exist for the disk space estimation
2) the folder hierarchy starts in the folder the User picks for the "Select Installation Folder"
3) and one of the folders in that hierarchy is being named by the End User in a dialog with an EditBox

It also seems that if I put the PropertySource with PropertyName MY_FOLDER_NAME into CustomActions before
InstallUISequence + CostInitialize and InstallExecuteSequence + CostInitialize
(such as InstallUISequence + AppSearch and InstallExecuteSequence + AppSearch),
then I get an error msg about a network drive not existing (named "down1\default text for the MY_EDIT_name" as soon as I go to test Install.
But if I set the PropertySource at CostInitialize,
then the files all go the c: drive and not the z: drive (because I am changing this via the controls in the "Select Installation Folder" dialog).

???
reo
Posts: 7
Joined: Mon Jun 07, 2010 4:42 pm

Re: Editbox gives name within ApplicationFolder hierarchy

Finally figured it out!
Two things:

1) To get the EditBox to show it's default:
a) In the "Custom Actions" in the "UI Custom Actions", do a RMC (right mouse click)
and select from "Add Predefined UI Custom Actions", the "Update MSI Edit Controls"
b) To the Custom Dialog I added that has the EditBox on it (which was not showing it's default),
for the dialog's "InitEvents" click the "New..." button and add a
DoAction
UpdateMsiEditControls
1
c) I don't know if I need to but I chnaged the name of the "Install Parameter" for the EditBox
to all uppercase ("MY_EDIT_NAME"). The "Value" of this property gets set on the "Install Parameter" page.

2) In the "Custom Actions" I was using a "Property Set With Formatted"...
WRONG!
Didn't matter what Action I hung this thing on. Files always went to the wrong place after changing the Folder to install to.
What I needed to be doing was using a "Directory Set With Formatted" on the Action "CostFinalize".
("Directory Set With Formatted" only seems to activate on the Action of CostFinalize.)
Then select the folder I wanted (which is "MY_FOLDER_NAME").
And then enter the "Formatted Text" of [APPDIR]down1\[MY_EDIT_NAME]
Of course this needs to "shift dragged" so it appears in both the "CostFinalize" for the InstallUISequence and InstallExecuteSequence.

And when I test it, it does what I expect now!

[Application Folder]
+ down1
| + UserEditableName
| | + down2
| | | + down3
| | | | + down4
| | | | | + (lots of files and folder)

:D
GabrielBarbu
Posts: 2146
Joined: Thu Jul 09, 2009 11:24 am
Contact: Website

Re: Editbox gives name within ApplicationFolder hierarchy

Hello,

I'm glad you got this working.
Thank you for sharing your solution with the Advanced Installer community.

Best regards,
Gabriel
Gabriel Barbu
Advanced Installer Team
http://www.advancedinstaller.com/

Return to “Common Problems”