Script could not be run? - Advanced Installer Community

We’re moving our forums to a new platform.

You can still browse and search existing topics, but you can no longer create new topics or post replies.

For questions, technical issues, or feature requests, please don’t hesitate to contact our support team at support@advancedinstaller.com.

Thank you for your understanding!

AlexanderK
Posts: 12
Joined: Thu May 31, 2012 9:04 pm

Script could not be run?

I know Advanced Installer doesn't offer support for scripts, but the script works externally so I'm trying to find out if I've set all the setting in AI correctly:

Code: Select all

' Set contants for the INSTALLSTATE_ABSENT and INSTALLSTATE_LOCAL feature states
Const msiInstallStateAbsent = 2
Const msiInstallStateLocal  = 3

' Initialize the install states of the mutually exclusive features 
' and set their states based on the radio button selection
Session.FeatureRequestState("FeatureA") = msiInstallStateAbsent
Session.FeatureRequestState("FeatureB") = msiInstallStateAbsent

If Session.Property("RADIO") = "RadioFeatureA" Then
  Session.FeatureRequestState("IntToolbarInstaller") = msiInstallStateLocal
  Session.FeatureRequestState("IntToolbarInstaller_1") = msiInstallStateAbsent
  Session.FeatureRequestState("IntToolbarInstaller_2") = msiInstallStateAbsent
ElseIf Session.Property("RADIO") = "RadioFeatureB" And Session.Property("CHECK1") = "install" Then
  Session.FeatureRequestState("IntToolbarInstaller_1") = msiInstallStateLocal
  Session.FeatureRequestState("IntToolbarInstaller") = msiInstallStateAbsent
  Session.FeatureRequestState("IntToolbarInstaller_2") = msiInstallStateAbsent
ElseIf Session.Property("RADIO") = "RadioFeatureB" And Session.Property("CHECK2") = "install" Then
  Session.FeatureRequestState("IntToolbarInstaller_2") = msiInstallStateLocal
  Session.FeatureRequestState("IntToolbarInstaller") = msiInstallStateAbsent
  Session.FeatureRequestState("IntToolbarInstaller_1") = msiInstallStateAbsent
Else
  Session.FeatureRequestState("IntToolbarInstaller") = msiInstallStateAbsent
  Session.FeatureRequestState("IntToolbarInstaller_1") = msiInstallStateAbsent
  Session.FeatureRequestState("IntToolbarInstaller_2") = msiInstallStateAbsent
End If
Image
Image

Basically: Is it a scripting problem or is there some settings I haven't set up properly that could affect this?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Script could not be run?

Hello,

If you want to install a feature based on conditions set from UI, then you can proceed like this:
- Go to "Organization" page and select the related feature.
- Enable "Install based on condition" option from "Feature Properties" right pane and set the desired conditions.
- Go to "Custom Action" page and add the "UpdateFeaturesInstallStates" custom action. Please keep in mind that this custom action is available only in version 9.3 of Advanced Installer.
- Build and run your project.

If you are using a lower version of Advanced Installer than 9.3, then you can take a look on our "Show a custom feature selection dialog" article.

Also, please keep in mind that "Session.FeatureRequestState" property can be used to set a feature action, and not a component action.

Let us know if this helps, otherwise give us more details about your scenario.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
AlexanderK
Posts: 12
Joined: Thu May 31, 2012 9:04 pm

Re: Script could not be run?

Daniel.Radu wrote:Hello,

If you want to install a feature based on conditions set from UI, then you can proceed like this:
- Go to "Organization" page and select the related feature.
- Enable "Install based on condition" option from "Feature Properties" right pane and set the desired conditions.
- Go to "Custom Action" page and add the "UpdateFeaturesInstallStates" custom action. Please keep in mind that this custom action is available only in version 9.3 of Advanced Installer.
- Build and run your project.

If you are using a lower version of Advanced Installer than 9.3, then you can take a look on our "Show a custom feature selection dialog" article.

Also, please keep in mind that "Session.FeatureRequestState" property can be used to set a feature action, and not a component action.

Let us know if this helps, otherwise give us more details about your scenario.

All the best,
Daniel
Here are the steps I've done:

Gone to "Organization" section -> Set ToolbarHome/ToolbarOnly/ToolbarComplete to Install Based On Condition = 3
Added the UpdateFeaturesInstallState
I still get the error.
Also is it possible to run command line switches?
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Script could not be run?

Hello,

I'm afraid I don't fully understand what you are trying to achieve. Can you please give us more details about your scenario (maybe exemplify) and about what do you want to achieve?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
AlexanderK
Posts: 12
Joined: Thu May 31, 2012 9:04 pm

Re: Script could not be run?

Daniel.Radu wrote:Hello,

I'm afraid I don't fully understand what you are trying to achieve. Can you please give us more details about your scenario (maybe exemplify) and about what do you want to achieve?

All the best,
Daniel
Sure.
I'd like to have a dialog that allows users to install a toolbar. That program is an .exe file which needs to be executed with different command switches depending on what version is selected.
The UI is in the first post. So if the users selects the first radial button and clicks next, the toolbar would install with all it's features (defined by the command line switches). If the user selects the second radial button but doesn't tick any of the tick boxes, nothing is installed. If he selects one of the tick boxes, the toolbar is installed with only certain features, etc..

So to try and achieve that here is what I've done:
Prerequisites>Feature Based>Add the same file, but with 3 different options:
http://i48.tinypic.com/rcr0qo.jpg
http://i49.tinypic.com/33m7aye.jpg
http://i48.tinypic.com/25729le.jpg
Organisation>For each of the features, install based on condition 3:
http://i50.tinypic.com/t0p389.jpg
Custom Action>UpdateFeatureInstallStates
Custom Action>Custom script that is in the first post

Theoretically it seems to me that it should work, but I'm not sure why it isn't.
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Script could not be run?

Hello,

In order to achieve what you want you can proceed like this:
- Go to "Dialogs" page and create a new dialog containing a radio button group with two radio buttons and two check boxes controls.
- Select the radio button group and set the "Property Name" field, from "Properties" right pane, to RADIO.
- Select the first radio button and set the "Value" field, from "Properties" right pane, to A and "Text" field to RadioFeatureA.
- Select the second radio button and set the "Value" field, from "Properties" right pane, to B and "Text" field to RadioFeatureB.
- Select the first check box control and, from "Properties" right pane, set the following fields like this:
  • Text: Check1
    Property Name: CHECKBOX1
    Value: checked
- Select the second check box control and, from "Properties" right pane, set the following fields like this:
  • Text: Check2
    Property Name: CHECKBOX2
    Value: checked
- If you want the two check boxes to be enabled only when the second radio button is selected, then for each of them you should add the following control conditions:
  • Condition: RADIO = "A"
    Action: Disable

    Condition: RADIO = "B"
    Action: Enable
- Go to "Organization" page and select the feature of your first prerequisite (ToolbarComplete). From "Feature Properties" right pane enable "Install based on condition" option and set the following condition (the prerequisite will install when first radio button is selected):
  • Condition: RADIO = "A"
- Select the feature of your second prerequisite (ToolbarOnly). From "Feature Properties" right pane enable "Install based on condition" option and set the following condition (the prerequisite will install when first check box is checked):
  • Condition: CHECKBOX1 = "checked"
- Select the feature of your third prerequisite (ToolbarHome). From "Feature Properties" right pane enable "Install based on condition" option and set the following condition (the prerequisite will install when second check box is checked):
  • Condition: CHECKBOX2 = "checked"
- Go to "Custom Actions" page and add "UpdateFeaturesInstallStates" custom action before "Wizard Dialogs Stage" -> "User Selection" -> "ProgressDlg" standard action.
- Please keep in mind that on Windows Vista and above, in order to silently install the prerequisites packages (using command line parameters set in "Install Command Lines" fields from "Prerequisites" -> "Setup Files" tab) the main installation package should run elevated. So, from "Install Parameters" page you should check "Run as administrator" option.
- Build and run your project.

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube
AlexanderK
Posts: 12
Joined: Thu May 31, 2012 9:04 pm

Re: Script could not be run?

Hi Daniel,

Your instructions worked perfectly except I get the following issue:

The installer runs and when everything is selected at the Progress Dialog it says "installing prerequisites"...but then when I open the web browser after installation to see if the toolbar installs, it hasn't?
I made sure to run under administrator privileges.

What could cause the .exe/prerequisite not being executed/installed?

Thanks,
Alex
Daniel.Radu wrote:Hello,

In order to achieve what you want you can proceed like this:
- Go to "Dialogs" page and create a new dialog containing a radio button group with two radio buttons and two check boxes controls.
- Select the radio button group and set the "Property Name" field, from "Properties" right pane, to RADIO.
- Select the first radio button and set the "Value" field, from "Properties" right pane, to A and "Text" field to RadioFeatureA.
- Select the second radio button and set the "Value" field, from "Properties" right pane, to B and "Text" field to RadioFeatureB.
- Select the first check box control and, from "Properties" right pane, set the following fields like this:
  • Text: Check1
    Property Name: CHECKBOX1
    Value: checked
- Select the second check box control and, from "Properties" right pane, set the following fields like this:
  • Text: Check2
    Property Name: CHECKBOX2
    Value: checked
- If you want the two check boxes to be enabled only when the second radio button is selected, then for each of them you should add the following control conditions:
  • Condition: RADIO = "A"
    Action: Disable

    Condition: RADIO = "B"
    Action: Enable
- Go to "Organization" page and select the feature of your first prerequisite (ToolbarComplete). From "Feature Properties" right pane enable "Install based on condition" option and set the following condition (the prerequisite will install when first radio button is selected):
  • Condition: RADIO = "A"
- Select the feature of your second prerequisite (ToolbarOnly). From "Feature Properties" right pane enable "Install based on condition" option and set the following condition (the prerequisite will install when first check box is checked):
  • Condition: CHECKBOX1 = "checked"
- Select the feature of your third prerequisite (ToolbarHome). From "Feature Properties" right pane enable "Install based on condition" option and set the following condition (the prerequisite will install when second check box is checked):
  • Condition: CHECKBOX2 = "checked"
- Go to "Custom Actions" page and add "UpdateFeaturesInstallStates" custom action before "Wizard Dialogs Stage" -> "User Selection" -> "ProgressDlg" standard action.
- Please keep in mind that on Windows Vista and above, in order to silently install the prerequisites packages (using command line parameters set in "Install Command Lines" fields from "Prerequisites" -> "Setup Files" tab) the main installation package should run elevated. So, from "Install Parameters" page you should check "Run as administrator" option.
- Build and run your project.

All the best,
Daniel
Daniel
Posts: 8283
Joined: Mon Apr 02, 2012 1:11 pm
Contact: Website

Re: Script could not be run?

Hello Alex,

I'm not sure why you are encountering this behavior. Can you please test the related toolbar installation from a Command Prompt using your command line parameters? If it is working using Command Prompt and not using Advanced Installer, can you please send us the .AIP (project file) and a verbose log of the installation to support at advancedinstaller dot com so we can investigate them?

All the best,
Daniel
Daniel Radu - Advanced Installer Team
Follow us: Twitter - Facebook - YouTube

Return to “Building Installers”