topper_harley
Posts: 24
Joined: Fri Aug 24, 2007 1:13 pm

Property based Folders and Custom Folder Dialog...

Hi there!

I got a little problem with Property Based Folders (using AI 5.2.1).
I though, it's gonna to work this way: Create a new property in "Install Parameters/Properties" and then in "Files and Folders" create a new Properts Based Folder and assign it to the property.
But when the MSI-package initializes, it always fails with the message "Could not access network location Your Value." (where "Your Value" is the default property value set in "Install Parameters").

Never mind, solved it removing the property from "Install Parameters" and creating a Custom Action "Property set with Formatted" where I initialize the property an another Custom Action with a VB-script where I set the propper value. That works fine :D

(Take it as tweak-report btw ^^)

What I'm now trying to do, is to install my application and its data into two separate folders (e.g. "C:\Program Files\MyApp\" for binaries and "C:\Documents and Settings\All Users\Application Data\MyApp\" for data).
Since I can only specify one path during UI installation, I found the tutorial how to add a custom folder dialog to the UI sequence. Well, in the example it looks well, but i need to modify it a litte bit:
I would like to have it AFTER the "SetupTypeDlg"-dialog and it must not appear when the database-feature is not selected...
I can't figure out how to change the sequence of dialogs and also I've got no idea woh to bind the folder dialog to the feature...

Comments and ideas welcome ^^
topper_harley
Posts: 24
Joined: Fri Aug 24, 2007 1:13 pm

So if I can't arrange the sequence in the dialog treeview, I might edit the events of the "Back"- and "Next"-buttons of some dialogs setting an "NewDialog"-event for the dialog I'd like to have next...
But this does not to be a proper clean solution because I can't get rid of the default "NextDialog"-event...
Cosmin
Posts: 5797
Joined: Tue Jul 10, 2007 6:39 pm
Contact: Website

Hi,

First, in the "Install Parameters" page you create an empty property (MY_DIR ). In the "Files and Folders" page you create a "Property Based" folder using MY_DIR (this folder is the second install folder).

You create the "Property Set with formatted" custom actions under "InstallUISequence -> Begin" and "InstallExecuteSequence -> Begin" nodes like in the tutorial http://www.advancedinstaller.com/user-g ... older.html .

Under "UI Custom Actions" you create a "New attached custom action" which will be the script.vbs file containing this:

Code: Select all

Const msiInstallStateLocal  = 3
Const msiInstallStateSource = 4

If Session.FeatureRequestState("Feature") = msiInstallStateLocal Or Session.FeatureRequestState("Feature") = msiInstallStateSource Then 
  Session.Property("SHOW_DLG") = "Yes" 
Else 
  Session.Property("SHOW_DLG") = "No"
End If
Where Feature is the identifier shown in the "Organization" page for the feature you want (in your case the database-feature). SHOW_DLG is a property used to determin if that feature will be installed local (FeatureRequestState=3) or from source (FeatureRequestState=4).

In the "Dialogs" page, in the "SetupTypeDlg" tree, in the "CustomizeDlg" dialog you create a new dialog (NewDialog), you select the "Next" button and under "Published Events" you should add this:

Code: Select all

Event_____|__Argument______|__Condition
DoAction  | script.vbs     | 1
NewDialog | NewDialog      | SHOW_DLG = "Yes"
NewDialog | VerifyReadyDlg | ((NOT Installed) OR (InstallMode = "Change")) AND (SHOW_DLG = "No")
In the "NewDialog" dialog you create the path editbox and the Browse button like in the tutorial and for the "Next" button, under "Published Events" you should have :

Code: Select all

Event_________|_Argument_______|_Condition
SetTargetPath | MY_DIR         | 1
NewDialog     | VerifyReadyDlg | 1
Now, only if the feature with the Identifier "Feature" (database-feature in your case) will be installed the dialog with the second installation folder will be shown.

To maximize the functionality, on the "NewDialog" dialog you select the "Back" button and under "Published Events" you add this :

Code: Select all

Event_______|_Argument______|_Condition
NewDialog   | CustomizeDlg  | 1
This will enable the user to go back and modify which features will be installed.

Regards,
cosmin
Cosmin Pirvu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
topper_harley
Posts: 24
Joined: Fri Aug 24, 2007 1:13 pm

Thank you for your reply. I guess this is a better solution than editing the AIP-file (I know I should'n, but I did :D)

Here's what I did to the AIP-file:

Code: Select all

  <COMPONENT cid="caphyon.advinst.msicomp.MsiControlEventComponent">
    <ROW Dialog_="WelcomeDlg" Control_="Next" Event="NewDialog" Argument="SetupTypeDlg" Condition="AI_INSTALL" Ordering="1"/>
    <ROW Dialog_="MaintenanceTypeDlg" Control_="Back" Event="NewDialog" Argument="MaintenanceWelcomeDlg" Condition="AI_MAINT" Ordering="1"/>
    <ROW Dialog_="MaintenanceWelcomeDlg" Control_="Next" Event="NewDialog" Argument="MaintenanceTypeDlg" Condition="AI_MAINT" Ordering="2"/>
    <ROW Dialog_="PatchWelcomeDlg" Control_="Next" Event="NewDialog" Argument="VerifyReadyDlg" Condition="AI_PATCH" Ordering="3"/>
    <ROW Dialog_="SetupTypeDlg" Control_="Back" Event="NewDialog" Argument="WelcomeDlg" Condition="AI_INSTALL" Ordering="1"/>
    <ROW Dialog_="CustomizeDlg" Control_="Next" Event="NewDialog" Argument="DataFolderDlg" Condition="1 AND ((&DatabaseFeature = 3) AND NOT (!DatabaseFeature = 3))" Ordering="2"/>
    <ROW Dialog_="CustomizeDlg" Control_="Next" Event="NewDialog" Argument="VerifyReadyDlg" Condition="(NOT Installed) OR (InstallMode = "Change")" Ordering="1"/>
    <ROW Dialog_="DataFolderDlg" Control_="Browse" Event="[_BrowseProperty]" Argument="DATAFOLDER" Condition="1" Ordering="1"/>
    <ROW Dialog_="DataFolderDlg" Control_="Browse" Event="SpawnDialog" Argument="BrowseDlg" Condition="1" Ordering="2"/>
    <ROW Dialog_="DataFolderDlg" Control_="Cancel" Event="SpawnDialog" Argument="CancelDlg" Condition="1" Ordering="1"/>
    <ROW Dialog_="DataFolderDlg" Control_="Back" Event="NewDialog" Argument="CustomizeDlg" Condition="1" Ordering="1"/>
    <ROW Dialog_="DataFolderDlg" Control_="Next" Event="NewDialog" Argument="VerifyReadyDlg" Condition="1" Ordering="1"/>
    <ROW Dialog_="VerifyReadyDlg" Control_="Back" Event="NewDialog" Argument="PatchWelcomeDlg" Condition="AI_PATCH" Ordering="1"/>
  </COMPONENT>

Return to “Common Problems”