Community Forums
Results 1 to 5 of 5

Thread: Force one of two features

  1. #1
    marlon Guest

    Force one of two features

    Hi,

    using InstallShield X Express, i'm trying to give a Localisation choice to my users using features. I added two features, one for each language, that each copy a certain file (containing the localisation info).

    Now, is it possible to force the user to install at least one of both.

    Related: is it possible to narrow the choice for each feature to: installing/not installing, so to leave out the 'Install when required' option?

    Or is it advised to do the localisation in a complete seperate way (two different setup files)

    thanks,
    Vincent

  2. #2
    Join Date
    Oct 2001
    Location
    Schaumburg, IL
    Posts
    849
    To leave out the 'Install when required' option, set the Advertised option to 'Disallow Advertise'.

    To force a user to Install one feature, you would need to create a Custom Action that tests each feature. And if none are selected, selects one.

    The Custom Action could be written in VB Script or C++. If want to write it in VBScript, read the MSI help topic on the "Session object", and use methods like

    Session.FeatureRequestState("MyFeature")=3

    (3 = msiInstallStateLocal)

    MyFeature is the Key Name from the Features view -- not the name you gave the feature.

    If you code the Custom Action in C++ look at the API's

    MsiGetFeatureState
    MsiSetFeatureState

    Hope this helps,
    Mike Marino

  3. #3
    Join Date
    Jul 2004
    Location
    UK
    Posts
    29
    I have a similar problem, a number of features that I want to select/deselect according to the locale of the target machine.

    I've set up a custom action that is called "After Setup Type Dialog".

    The idea is that if the user selects "Typical" only the features for the default locale are installed.

    If the user selects "Custom" I can pre-select the features for the current locale. Should the user choose to he can add additional language features from the "Custom Setup" dialog.

    The custom actions calls MsiSetFeatureState(..,..,INSTALLSTATE_ABSENT) for all the language features and then calls MsiSetFeatureState(..,..,INSTALLSTART_LOCAL) for the features that are needed.

    Problem is that when the "Custom Setup" dialog is displayed the state of the features has reverted back to the default settings from the "Setup Types" section of the Installation Desginer.

    Anyone (Mike?) got any ideas?

    Thanks.

  4. #4
    Join Date
    Oct 2001
    Location
    Schaumburg, IL
    Posts
    849
    I think the problem is where your custom action is getting scheduled. We use that same location to set a bunch of properties to get the Feature States to the state you set in the IDE.

    Here is what to look at:

    1. Get Orca.exe
    2. Open your Project file in Orca.exe
    3. Go to the Control Event table.
    4. Sort by the Dialog_
    5. Scroll Down until you see the records where
    Dialog_ = SetupType
    And
    Control_ = Next

    In this groups of records you will probably see a Bunch of
    Event = AddLocal

    These are adjusting the Feature State of the Feature Listed. Note the Value in the Order Column

    Now look for

    Argument=<Your Custom Action name.>

    Look at the value in the Order column. You want to make sure the order of your Custom action is greater than the AddLocal Actions. If not, the AddLocal Might change the state you are setting.

    This is just a guess.

  5. #5
    Join Date
    Jul 2004
    Location
    UK
    Posts
    29
    Hello Mike,

    Yup, that seems to do it. I changed the value in the "Order" column to "7", which was one greater than the value used for all the "AddLocals" in that section. Pointing the installer engine at the modified MSI file installed as I wanted. Great.

    Can I modify the execution order from the Express IDE, or will I have to do it "by hand" after each build? Or do I need to upgrade to IS X Pro for this functionality?

    Best Regards,

    John.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •