Kinook Software Forums

Kinook Software Forums (
-   [VBP] User Tips, Tricks and Samples (
-   -   Retry a step conditionally (

deramor 03-05-2019 05:10 PM

Retry a step conditionally
Hello. I would like to retry a step when it fails but only if the step originally failed with a specific exit code.

Sometimes when running Installshield steps, a license can't be retrieved. This errors with an exit code of 7159. I found this thread: however that doesn't have conditions on the retry logic. Any thoughts on this? I was thinking it could probably be done in the script editor for the step in question but I have no idea where to start there.

kinook 03-05-2019 06:36 PM

I was going to say, in the step's vbld_StepDone script event, do something like this:


Sub vbld_StepDone()

  ' get the exit code of the program
  exitCode = CLng(Application.Macros(vbldMacroAll)("RUNPROGRAM_EXITCODE").Value)

  ' treat anything but 7159 as success
  If exitCode <> 7159 Then Step.BuildStatus = vbldStepStatSucceeded

End Sub

But that won't fail the step without retry for other non-zero exit codes.

I think you would need to roll your own retry using the Loop action.

deramor 03-06-2019 06:04 PM

Is there a way to continue to loop given the value of a macro? Loop is limited by count or file contents but not a conditional statement.

Perhaps using the General tab to execute the step according to an expression.
Then loop on a count so it doesn't run off forever.

The resulting logic roughly would be:
if(expression == TRUE && count < maxNumberOfLoops)
do the loop


kinook 03-06-2019 06:40 PM

You can use the Exit action to end a loop.

Or you can use a repeating build rule instead of a Loop action.

All times are GMT -5. The time now is 06:52 PM.

Copyright 1999-2019 Kinook Software, Inc.