Break out of processTest loop?

Comments

1 comment

  • Avatar
    juanjo

    You could use the below code:

    <showProgressDialog>
        <title>Waiting for myapp.exe to exit</title>
        <actionList>
            <setInstallerVariable name="tries" value="0"/>
            <while>
                <actionList>
                    <wait>
                        <ms>1000</ms>
                    </wait>
                   <mathExpression>
                      <text>${tries}+1</text>
                      <variable>tries</variable>
                   </mathExpression>
                   <break>
                        <ruleList>
                          <compareValues>
                             <logic>greater_or_equal</logic>
                             <value1>${tries}</value1>
                             <value2>6</value2>
                          </compareValues>
                        </ruleList>
                   </break>
                </actionList>
                <conditionRuleList>
                    <processTest>
                        <logic>is_running</logic>
                        <name>myapp.exe</name>
                    </processTest>
                </conditionRuleList>
            </while>
        </actionList>
    </showProgressDialog>
    
    <throwError text="The program did not stop!">
        <ruleList>
           <compareValues>
              <logic>greater_or_equal</logic>
              <value1>${tries}</value1>
              <value2>6</value2>
           </compareValues>
           <processTest>
              <logic>is_running</logic>
              <name>myapp.exe</name>
           </processTest>
        </ruleList>
    </throwError>
    

Please sign in to leave a comment.