An update on progress:
ash_microsec wrote:
1. When my custom dialog is displayed, the Next button is disabled even though the file searched for by "LICENSEFILE_EXISTS" exists. It appears the "LICENSEFILE_EXISTS" search does not work?
This was a sneaky one. My Next button had 2 control coditions, "LICENSEFILE_EXISTS" and "NOT LICENSEFILE_EXISTS". This was incorrect. The control conditions needed to be "LICENSEFILE_EXISTS = 1" and "LICENSEFILE_EXISTS = 0". The Next button was then correctly enabled/disabled when the dialog was first displayed.
ash_microsec wrote:
2. After the user has clicked the Browse button, the "LICENSEDIR" property is updated and the value displayed in the PathEdit control. An automated check then needs to be performed to check that the file specified by the updated "[LICENSEDIR][LICENSEFILE]" resolved value exists, so that the Next button is then enabled. How do I achieve this?
This took what I consider to be a hack to get it working. Firstly, I created my own copy of the BrowseDlg so I could change it without breaking anything else (and when I set the "Property Name" to "_BrowseProperty" on the "Directory Combo", "Directory List" and "Path Edit", it worked like the original).
On the OK button, I had 3 events:
1. "DoAction" event with "CheckLicenseFileExists" argument (vb script).
2. "SetTargetPath" event with "[_BrowseProperty]" argument for the "LICENSEFILE_EXISTS = 1" condition.
3. "EndDialog" event with "Return" argument for the "LICENSEFILE_EXISTS = 1" condition.
On the Cancel button, I had 3 events:
1. "Reset" event with "0" argument.
2. "DoAction" event with "CheckLicenseFileExists" argument (vb script).
3. "EndDialog" event with "Return" argument.
My "CheckLicenseFileExists" script is as follows:
Code: Select all
Function checkLicenseFileExists()
dim license_file
license_file = Session.Property("LICENSEDIR")
If Right(license_file, 1) = "\" Then
license_file = license_file & Session.Property("LICENSEFILE")
Else
license_file = license_file & "\" & Session.Property("LICENSEFILE")
End If
Set objFSO = CreateObject("Scripting.FileSystemObject")
If objFSO.FileExists(license_file) Then
Session.Property("LICENSEFILE_EXISTS") = "1"
Else
Session.Property("LICENSEFILE_EXISTS") = "0"
MsgBox "Selected folder must contain the '" & Session.Property("LICENSEFILE") & "' license file." & vbCrLf & vbCrLf & "Please select a valid folder.",vbOKOnly,"Invalid License Folder"
End If
checkLicenseFileExists = 1 ' msiDoActionStatusSuccess
End Function
This provides the following behaviour:
- When the Cancel button is pressed, the Browse dialog is closed.
- When the OK button is pressed and an invalid folder has been specified, the script fails to find the file and displays a popup message is displayed. When closed, the Browse dialog is not closed.
- When the OK button is pressed and a valid folder has been specified, the Browse dialog is closed.
The Next button is enabled/disabled based upon the value the script set the "LICENSEFILE_EXISTS" property to.
FOLLOW US
Get the latest news in Application Packaging