Kinook Software Forums

Kinook Software Forums (http://www.kinook.com/Forum/index.php)
-   [VBP] User Tips, Tricks and Samples (http://www.kinook.com/Forum/forumdisplay.php?f=19)
-   -   Retry a step conditionally (http://www.kinook.com/Forum/showthread.php?t=5571)

deramor 03-05-2019 04: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: https://www.kinook.com/Forum/showthr...?threadid=3887 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 05:36 PM

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

Code:

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

https://kinook.com/VisBuildPro/Manual/scriptevents.htm

https://kinook.com/VisBuildPro/Manual/scripteditor.htm

https://kinook.com/VisBuildPro/Manua...gramaction.htm

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 05: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
endif

Thoughts?

kinook 03-06-2019 05:40 PM

You can use the Exit action to end a loop.

https://kinook.com/VisBuildPro/Manual/exitaction.htm

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

https://kinook.com/VisBuildPro/Manual/buildrules.htm


All times are GMT -5. The time now is 11:36 AM.


Copyright 1999-2019 Kinook Software, Inc.