Page 1 of 2
How can I let the user select multiple destination folders?
Posted: Wed Oct 17, 2007 3:27 pm
by Chris Miller
Is it possible to prompt the user for multiple destination folders? I just bought IA7 Studio and I'm redoing a project that was originally done in Wise WFWI. I have three features, one is for an ASP.NET application, the other two install some Win32 executables.
I would like to be able set the destination folder for each feature. In addition, I would also like to be able to let the user specify the name for the virtual directory.
For the "Create IIS Virtual Folder" action, can I use a variable for the Virtual Path? Can I use a variable for the physical path?
thanks,
Chris Miller
VersaTrans Solutions, Inc
Posted: Thu Oct 18, 2007 5:05 pm
by Alex_Ronquillo
Is it possible to prompt the user for multiple destination folders?
Yes it is possible. Here is how you would do it:
1.- Give a name to the button you want to use, let's say you name it DIR
2.- Change the action of the button to "Select Custom Folder"
3.- On the textbox you want to link to DIR button select "[Written Variable Values]" in the "Receives Information" field.
4.- In the "Writes Values to Variable" field enter DIR
Attached is a zip file with images showing what I just explained you.
For the "Create IIS Virtual Folder" action, can I use a variable for the Virtual Path? Can I use a variable for the physical path?
Yes, you can. You can use variables in both fields.
File Attached:
steps1-4.zip
Posted: Fri Oct 19, 2007 11:16 am
by Chris Miller
Thanks! That was just what I needed.
Posted: Fri Oct 19, 2007 1:50 pm
by Chris Miller
Will that work with the TPTShellTree control? I have the "Vista Black" theme installed and I made a copy of the destination dialog (as destinationweb). I added an edit field for the virtual directory name and set
- "Receives Information" to "[Written Variable Value]"
"Writes Values to Variable" to "WEBVIRTDIRNAME"
I initialize WEBVIRTDIRNAME to the name I want and that part works.
The second edit control has the following properties
- "Receives Information" to "[Written Variable Value]"
"Writes Values to Variable" to "WEBVIRTDIR"
I initialize WEBVIRTDIR to $WWWROOTDIR$\\MyApp
This dialog uses a TPTShellTree control and I set it's properties to
- "Receives Information" to "[Written Variable Value]"
"Writes Values to Variable" to "WEBVIRTDIR"
At runtime, the TPTShellTree and the edit control display the user's Desktop folder. This only happens when the TPTShellTree is using the WEBVIRTDIR variable. If I set the TPTShellTree control to use a differen variable, the edit control has the correct default value.
How can I use the TPTShellTree control to work with the same results as your example?
Posted: Fri Oct 19, 2007 2:37 pm
by Alex_Ronquillo
It works the same way. However, the default value of the PTShellTree must be a folder that exists, otherwise it will take desktop as default.
Posted: Fri Oct 19, 2007 2:45 pm
by Chris Miller
Thanks, I thought that was the case. How can I make it behave with a custom dir variable (that does not yet exist) in the same it does with the installdir?
In that case, the edit field displays "c:\\program files\\myapp" and the PTShellTree control displays "c:\\program files".
For the virtual directory I would like the edit control to display the equivalent of c:\\inetpub\\wwwroot\\myapp" and the PTShellTree control to display "c:\\inetpub\\wwwroot".
Posted: Fri Oct 19, 2007 5:19 pm
by Alex_Ronquillo
I did not find a way to do it in the same dialog. However, a workaround would be to set a temp variable to the value of $TARGETDIR$ after the destination dialog, and in another dialog, use the PTShellTree and Edit controls as they were for $TARGETDIR$. After the second dialog, set your WEBVIRTDIR variable to $TARGETDIR$ and TARGETDIR to the first temp variable. That will work for your case. I Hope I explained it clear enough.
Posted: Sat Oct 20, 2007 8:14 am
by Chris Miller
Thanks! That was very clear. I think a couple of additional steps will be needed on order to handle navigating back to previous dialogs, but it soungs pretty straight forward. I think I would need to set temp variable to $TARGETDIR$ before the label for the first destination dialog, then set $TARGETDIR$ to the value of the temp variable after the label. That way, navigating back to the destination dialog from the web destination dialog would properly set $TARGETDIR$ to the correct value.
Thank you again for your prompt response. I've accomplished more in 1 week with InstallAware than I have with 2 years with Wise For Windows Installer.
Posted: Mon Oct 22, 2007 10:12 am
by Chris Miller
I tried that sequence of steps and it still displayed the desktop folder instead of the values that I wanted.
Just before the Display Dialog code, I have the line
Set Variable TARGETDIR to $WEBVIRTDIR$
Where $WEBVIRTDIR$ has been been previously initialized to $WWWROOTDIR$\\myapp.
If I comment out the Set Variable line, the controls display the contents of TARGETDIR, a folder that does not yet exist.
I took a look at the runtime values of the variables and TARGETDIR displays as an actual drive letter ("c:\\program files\\my company"), while $WWWROOTDIR$ is set to %SystemDrive%\\inetpub\\webroot".
If I hard-code TARGETDIR to path like c:\\inetpub\\webroot\\foo, then I get the proper values in the edit controls. It looks like the TPTShellTree control has a problem with environment variables. How can I replace %SystemDrive% with the actual drive letter?
Posted: Mon Oct 22, 2007 2:54 pm
by Alex_Ronquillo
Chris,
Environment variables are dereference in the following way in IA:
#Env_Var#, i.e. for %SystemDrive% use instead #SystemDrive#
Attached is a simple project showing you the steps I gave you work. Take a look at the MSICode. I changed the following lines:
73-74
158-177
Posted: Mon Oct 22, 2007 2:56 pm
by Chris Miller
I'm sorry, but I can't find any attachments with your last message. But I thin k I understand what needs to be done. I just do a
Replace %SystemDrive% with #SystemDrive# in variable WEBVIRTDIR
On a related not: I am getting the value "c:\\inetpub\\wwwroot\\" (with t4railing backslash) for the value of $WWWROOT$. Is that the way it's supposed to work? The other folders (like $PROGRAMFILES$" do not have the trailing backslash
Posted: Mon Oct 22, 2007 3:20 pm
by Alex_Ronquillo
Sorry,
My bad. I forgot the attachment. Here it is. The lines now are:
73-74
155-169
File Attached:
New Project.zip
Posted: Mon Oct 22, 2007 3:25 pm
by Alex_Ronquillo
All the folders you get their location with the "Get Folder Location" command have that backslash at the end. You sometimes don't see it, because IA eliminates it when using it for installation. You need to be careful with it, double backslash harms sometimes, for example for the MS SQL Server plug-in.
Posted: Mon Oct 22, 2007 3:28 pm
by Chris Miller
Thanks! You may want to update the help file that comes with IA. None of the sample folders displayed for the "Get Folder Location" topic have trailing backslashes.
Posted: Tue Apr 29, 2008 5:18 pm
by kamiller42
I trying to do this, but when the second directory's browse button is clicked, it does nothing. I followed these instructions too.
Custom Path Browsing: Directory browsers, edit boxes, and browse buttons worked in sync only when assigned to the $TARGETDIR$ variable. All of these controls can now be assigned to work with custom variables also. This lets you build dialogs where multiple destination paths are chosen simultaneously.
To use directory browsers and edit boxes with a custom path variable:
a. Set their "Receives Information" field to "[Written Variable Value]",
b. Set their "Writes Values to Variable" field to your custom variable.
To use browse buttons with a custom path variable:
a. Set their "Performs Action" field to "Select Custom Folder",
b. Set their "Name" property to your custom variable.
I am using IA6. Does this work with IA6?