Project Type: Basic MSI. InstallShield 11.0 Professional Edition.
Requirerments: I want the user of my setup kit to be able to change the drive of installation but not folder. After selecting the drive The folder should be as per my fixed folder name.
Process followed:
Created an Custom Action CAChangeInstallDir
Following attributes for CA.
1.VBScript Fie name: MyFxiedFolder.vbs
2.ReturnProcessing:Asynchronous (Waits for exist code)
3.In-script execution:Immediate Execution
4.Execution Scheduling:Execute Only Once
The CA is called from the dialog box InstalledChangeFolder ControlName: OK - Type - Push Button
Event Name - Argument - Condition
DoAction - CAChangeInstallDir - 1
SetTargetPath - [_BrowseProperty] - 1
EndDialog - Return - 1
Coding in MyFxiedFolder.vbs
Option Explicit
Dim MyFixFolder,InstallDefaultPath,InstallDefaultFolder,StrCmpFolder
Dim WshShell
Set WshShell = WScript.CreateObject("WScript.Shell")
MyFixFolder="THRTE_4.7.5\"
InstallDefaultPath =Session.Property("INSTALLDIR")
Msgbox InstallDefaultPath
If len(InstallDefaultPath)>3 Then
InstallDefaultFolder=left(InstallDefaultPath,3)
StrCmpFolder = StrComp(MyFixFolder,InstallDefaultFolder)
If StrCmpFolder <> 0 Then
Session.Property("INSTALLDIR")=Right(InstallDefaultPath,3) & MyFixFolder
End If
Elseif len(InstallDefaultPath)=3 then
Session.Property("INSTALLDIR")=InstallDefaultPath & MyFixFolder
End if
'Change the _BrowseProperty to new value
InstallDefaultPath =Session.Property(_BrowseProperty) &"\"
If len(InstallDefaultPath)>3 Then
InstallDefaultFolder=left(InstallDefaultPath,3)
StrCmpFolder = StrComp(MyFixFolder,InstallDefaultFolder)
If StrCmpFolder <> 0 Then
Session.Property(_BrowseProperty)=Right(InstallDefaultPath,3) & MyFixFolder
End If
Elseif len(InstallDefaultPath)=3 then
Session.Property(_BrowseProperty)=InstallDefaultPath & MyFixFolder
End if
MsgBox Session.Property(_BrowseProperty)
MsgBox Session.TargetPath("TARGETPATH")
MsgBox Session.TargetPath("INSTALLDIR")
WshShell.Quit
While application is installed on selecting the change folder option it canot process to create InstallDir, goes to theInstallation complete dialog.
Please let me know here is the fault or what I am missing.
Thanks
Sanjoygr@yahoo.co.in
Edited by sanjoygr, 21 March 2006 - 13:53.