VBScript Custom Action Example

InstallShield 2016 Express Edition

The following is an example of a VBScript custom action that determines the value of INSTALLDIR and changes it depending on the presence of a file.

  ' Get the value of INSTALLDIR

  Dim sInstalldir

  sInstalldir = Session.Property("INSTALLDIR")

 

  ' Show it.

  MsgBox sInstalldir

 

  ' Check to see if a file exists

  Dim pFs

  Set pFs = CreateObject("Scripting.FileSystemObject")

  Dim sSomeFile

  sSomeFile = sInstalldir & "31337.txt"

  If pFs.FileExists(sSomeFile) Then

    ' If it exists, change INSTALLDIR

    Session.Property("INSTALLDIR") = sInstalldir & "New"

  End If

See Also