Reputation: 457
I'm writing a custom script to go with my installer so that users have the option to install a toolbar if they wish. Here's what the layout will look like:
http://i47.tinypic.com/2v92csl.png
And the code accompanying it:
' Set Executable
Set WshShell = CreateObject("WScript.Shell")
' Set booleans for what features to enabled/disable
Dim Feature1 As Boolean
Dim Feature2 As Boolean
Dim Feature3 As Boolean
Dim Feature4 As Boolean
Feature1 = False
Feature2 = False
Feature3 = False
Feature4 = False
If Session.Property("RADIO") = "RadioFeatureA" Then
Feature1 = True
Feature2 = False
ElseIf Session.Property("RADIO") = "RadioFeatureB" Then
Feature2 = True
Feature1 = False
End If
' Set the checkbox1 feature if ticked
If Session.Property("CHECK1") = "install" Then
Feature3 = True
Else
Feature3 = False
End If
' Set the checkbox2 feature if ticked
If Session.Property("CHECK2") = "install" Then
Feature4 = True
Else
Feature4 = False
End If
' Execute the file
If Feature1 = True Then
WshShell.Run (""APPDIR\file.exe"" /SILENT /INSTALL)
ElseIf Feature2 = True And Feature3 = True Then
WshShell.Run (""APPDIR\file.exe"" /SILENT)
ElseIf Feature2 = True And Feature4 = True Then
WshShell.Run (""APPDIR\file.exe"" /SILENT)
ElseIf Feature2 = True And Feature3 = True And Feature4 = True Then
WshShell.Run (""APPDIR\file.exe"" /SILENT /INSTALL)
End If
But for some reason the installer crashes. The code looks fine to me and executes externally?
Upvotes: 2
Views: 1462
Reputation: 11023
I suspect the crash occurs when you try to launch your exdcutables. the reasons could be various, for example UAC rights. But whar caught my attention is how you are using APPDIR property. You should first get its value in a separate variable, then append the. executable name to the variable to get the correct path.
However, this will still not work because, I assume, you launch the script using a published event triggered by an action on your MSI dialog, that is before the files are installed, so your executables are not available.
From the screenshot I assume you are using Advanced Installer so you have two options to solve your problem:
Upvotes: 2