Recently, I've been playing around with the TestStand API and trying to create steps on the fly. This has been working well, but I wanted to try to program the Post Action for my created steps.
To start, let's assume you have already created your step (programmatically or not). Then, you have to set the Post Action for either a Pass or a Fail. For a Fail Post Action, this would look something like: RunState.SequenceFile.GetSequenceByName("YourSeq").GetStep(StepNum,StepGroup).FailAction=PostAction_GotoStep
For a Pass Post Action, just substitute FailAction with PassAction. And you have a few choices for the setting, which are documented in the help.
If you have chosen a GotoStep or CallCallback, you now have to set the location for where to go for the post action. If you're calling a sequence, this might be:
And again, you could substitute PassActionTargetByExpr if you're doing a Pass post action.
However, for my GotoStep, I just wanted to go to Cleanup, so I assumed I could set this as FailActionTargetByExpr="<Cleanup>", which works when I type that in. TestStand didn't like the "<", so then I tried escape characters, which didn't work. I tried "Cleanup" without the brackets. I tried using the Evaluate function on a handful of strings. I tried other things like "RunState.Sequence.Cleanup" (Now, I was just typing in anything I can think of.)
What I finally got working was creating a local string variable, which is initialized as "<Cleanup>". Then, I was able to use FailActionTargetByExpr="Locals.Cleanup", which worked just fine.
Problem solved. (There's likely a more elegant solution.) Hopefully, you googled this answer and you didn't waste 30 minutes experimenting as I did.
We just sent you an email. Please click the link in the email to confirm your subscription!
OKSubscriptions powered by Strikingly