Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

How to Change The value Of InstallDIR RUNTIME


2 replies to this topic

sanjoygr

sanjoygr
  • Full Members
  • 76 posts

Posted 16 March 2006 - 14:58

Dear All,
I want to know if it is possible to change the value of [INSTALLDIR] runtime?
On clicking the OK button of Destination dialog I want to fire a VBscript (DoAction event of NEXT push button). How to pass the value of present INSTALLDIR and manupulate in my function and send the correct value for INSTALLDIR?

Please let me know?


Thanks
Sanjoy

Stefan Krueger

Stefan Krueger

    InstallSite.org

  • Administrators
  • 13,269 posts

Posted 16 March 2006 - 19:48

Session.Property("INSTALLDIR")=whatever

sanjoygr

sanjoygr
  • Full Members
  • 76 posts

Posted 20 March 2006 - 07:32

I am having following problem in Changing the values of INSTALLDIR or _BrowseProperty at run time.

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 and 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:40.