Run program after install & present choices?

Comments

1 comment

  • Avatar
    juanjo

    You can add a <choiceParamter> and configure it to appear just before the final page:

    <parameterList>
        ...
        <choiceParameter>
            <name>choice</name>
            <description></description>
            <explanation>Please select an option</explanation>
            <value></value>
            <default></default>
            <allowEmptyValue>1</allowEmptyValue>
            <displayType>combobox</displayType>
            <insertBefore>installationFinished</insertBefore>
            <ordering>default</ordering>
            <width>30</width>
            <optionList>
            </optionList>
            <postShowPageActionList>
               <writeFile>
                 <path>${installdir}/selected_option.txt</path>
                 <text>${choice}</text>
               </writeFile>
            </postShowPageActionList>
        </choiceParameter>
        ...
    </parameterList>
    

    And add the choices using the stdout of the program:

    <postInstallationActionList>
        <runProgram>
            <program>${installdir}/some/command</program>
            <programArguments></programArguments>
        </runProgram>
        <addChoiceOptionsFromText>
            <name>choice</name>
            <text>${program_stdout}</text>
        </addChoiceOptionsFromText>
    </postInstallationActionList>
    

    The code above assumes the returned stdout is in the format expected by the <addChoiceOptionsFromText> action (you can find the details here). If it is not the case, you can use a combination of a <while> and <setInstallerVariableFromRegEx>. You can find some examples in the above-mentioned article.

Please sign in to leave a comment.