NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

I want to change the name of step during running

I want to change the name of step that is located in the MainSequence (for example, index 0 in the sequence) from SequenceFilePostStep callback sequence. Actually I want to get current system time in the SequenceFilePostStep sequence and to show it in the MainSequence window through step 0 of MainSequence.
Now I did it so. I created action in the SequenceFilePostStep sequence with ActiveXCom adapter, object reference RunState.SequenceFile.Data.Seq["MainSequence"].Main[0] , Automation Server - NI TestStand API 3.5, object class - Step, with Set Property : Name. And it works, but it changes the step name once, after that I don't see any change. It seems that I don't update window. Hope anyone will help!
0 Kudos
Message 1 of 7
(4,063 Views)
It sounds like you are wanting the name to be reflected permanently in the sequence file.  If this is the case, you would need to save the sequence file after editing it.  You can do this using the Save method from a SequenceFile ActiveX object.  For more detail about this method, refer to the TestStand help.  If you are still having trouble or I have misunderstood your problem, let us know and provide more detail.
Thanks,

Andy McRorie
NI R&D
0 Kudos
Message 2 of 7
(4,032 Views)

Hi, Andrew, thank you for your reply. The method Sequence.Save also doesn't help. I send you my small sequence for demonstrate you what I want to do. Note that I want my main sequence will show current time through first step and I change the name of this step in the SequenceFilePostStep.

0 Kudos
Message 3 of 7
(3,996 Views)

Using the method that we've been discussing up to this point, you can programmatically modify the sequence file.  However, since a sequence file is loaded initially at runtime, it would not be updated until the next execution.  If you want the name change to be reflected during runtime, you need to change the technique that you are using.  The best way to do this is to use Parameters.Step as the object name rather than RunState.SequenceFile.Data.Seq["MainSequence"].Main[0].  Since this operation would be applied to the entire sequence file (since it is in the SequenceFilePostStep callback), you need to use an if statement.  It would be best to give the first step of your MainSequence a very unique name so that the if condition is a simple check.  You would get the name of Parameters.Step, check if it is equal to a predetermined value, and then use the same call to set the name you are currently using (just with Parameters.Step instead).  I have attached your modified sequence file based on this discussion.

Hope this helps!

Message Edited by AndrewMc on 01-15-2007 11:22 AM

Thanks,

Andy McRorie
NI R&D
0 Kudos
Message 4 of 7
(3,968 Views)
If you are changing RunState.SequenceFile.Data.Seq["MainSequence"].Main[0] you are changing the edit time copy of the step, not the runtime copy. To change the runtime copy, if you are executing the sequence with the step in it, use RunState.Sequence.Main[0] instead. This is the copy of the sequence that is running and will not effect the actual file.

Are you wanting the name of this step to change as each step is executed in the sequence? If that is the case then the problem is likely that steps are only refreshed on trace events if the step just executed. You can force a refresh of all steps from inside the SequenceFilePostStep by posting a UIMsg_RefreshWindows msg and passing RunState.Caller as the activeXdata parameter. See the examples under Examples/callbacks to see how this is done.

Here's an excerpt from the help pages for UIMsg_RefreshWindows:

UIMsg_RefreshWindows–(Value: 27) Post this message to the user interface to instruct it to refresh the data it displays for the corresponding PropertyObjectFile or SequenceContext you pass for activeXDataParam. Pass a single reference or an ActiveX array of references using activeXDataParam to specify which window or windows to refresh. Pass a SequenceContext object to refresh the values for the steps which the user interface displays for that execution. Pass null for activeXDataParam to refresh the displays for all of the files and executions. The PostStepFailureCallback and the PostStepRuntimeErrorCallback examples located in the <TestStand>\Examples\Callbacks directory demonstrate how to use this UIMessage.

0 Kudos
Message 5 of 7
(3,955 Views)
I just realized that if you are inside of the SequenceFilePostStep callback and you want to change the name for the first step in the sequence that the callback is for you will need to use RunState.Caller.RunState.Sequence.Main[0] rather than RunState.Sequence.Main[0] as I stated in my previous post.

-Doug
0 Kudos
Message 6 of 7
(3,945 Views)

Hi, Doug,

thank you for your help !

It is that I need,

I did RunState.Caller.RunState.Sequence.Main[0] and added RefreshWindows callback -

and now it works Smiley Happy

 

0 Kudos
Message 7 of 7
(3,930 Views)