NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Programatically select a step in a sequence in a sequence file loaded in TestStand sequence editor using C#

Hi all,
 
I have written C# code to load a sequence file dynamically in TestStand Sequence editor. The code is as follows...
 

myEngine.PostUIMessage(mySequenceContext.Execution, mySequenceContext.Thread,

UIMessageCodes.UIMsg_OpenWindows, 0, null, mySequenceFile, true );

The code is working fine and I could view the Sequence file opened in TestStand Sequence editor.

Now, I wish to select one sequence in the opened sequence file to get the details of  the sequence programatically. In other words, I want to simulate a mouse click to a sequence and view the steps associated with that sequence.

Can anybody give some clues...

Thanks in advance.

0 Kudos
Message 1 of 9
(4,590 Views)
Hello Biju,

If you pass in the name of the sequence you are interested in into the string parameter of PostUIMessage, you will see that when the sequence file is displayed in the sequence editor, the sequence whose name you passed in will be displayed.  Let us know if this is not what you are looking for.

NickB
National Instruments
Applications Engineering
0 Kudos
Message 2 of 9
(4,561 Views)

Hi Nick,

My problem is not solved. I am using UIMessageCodes.UIMsg_RefreshWindows to refresh the loaded sequence file. I have passed the sequence name as you suggested. The code is as shown below.

myEngine.PostUIMessage(mySequenceContext.Execution, mySequenceContext.Thread,

UIMessageCodes.UIMsg_RefreshWindows,0,mySequence.Name, mySequenceFile, true);

The sequence name I passed is not getting selected.

Also I would like to know whether there is any method to select a particular step in a particular sequence.

Thanks,

Biju kuttan

 

0 Kudos
Message 3 of 9
(4,550 Views)
As of TS 4.0, you can use the UI controls to directly to change selections or perform other UI operations. Here is an outline:
 
1) Get the ApplicationMgr
 
applicationMgr = (ApplicationMgr)engine.GetInternalOption(InternalOption_ApplicationManager);
 
 
2) Get the SequenceFileViewMgr that is displaying your file:
 
sequenceFileViewMgr = (SequenceFileViewMgr)applicationMgr.GetSequenceFileViewMgr(mySequenceFile);
 
3) Use the methods/properties of the following collections to manipulate the selection: SequenceFileMgr.SelectedSteps, SequenceFileMgr.SelectedSequences.
 
0 Kudos
Message 4 of 9
(4,538 Views)
Hi James,
 
Now I could get the Sequence names selected in the Sequence editor's Sequences window. But the steps in these Sequence selected are not dynamically shown in the Steps window. Once if I click a Sequence manually, I am able to see these steps. Please tell me a way to do the same programatically.
 
Thanks,
Biju kuttan
0 Kudos
Message 5 of 9
(4,509 Views)
Hi,
 
Also I am getting error like "Index out of range. Source:  TSUISUPP.SelectedSteps   at NationalInstruments.TestStand.Interop.UI.Support.SelectedSteps.AddStep(Step val)". Error code: "-17500; Operation Failed." My code is like

mySequenceFile = myEngine.GetSequenceFileEx(

@"D:\dynamic loaded sequence.seq", 0, TypeConflictHandlerTypes.ConflictHandler_UseGlobalType);

mySequence = mySequenceFile.GetSequenceByName(

"First");

Step myStep = mySequence.GetStep(2, StepGroups.StepGroup_Main);

SequenceContext mySequenceContext = mySequenceFile.NewEditContext();

mySequenceContext .AsPropertyObject();

myEngine.PostUIMessage(mySequenceContext .Execution, mySequenceContext .Thread,

UIMessageCodes.UIMsg_OpenWindows, 0, null, mySequenceFile, true);

ApplicationMgr applicationMgr = (ApplicationMgr)myEngine.GetInternalOption(InternalOptions.InternalOption_ApplicationManager);

SequenceFileViewMgr sequenceFileViewMgr = (SequenceFileViewMgr)applicationMgr.GetSequenceFileViewMgr(mySequenceFile);

sequenceFileViewMgr.SelectedSequences.Clear();

sequenceFileViewMgr.SelectedSequences.AddSequence(mySequence);

sequenceFileViewMgr.SelectedSteps.AddStep(myStep);

I am sure that my Sequence selected in the Sequence file loaded has more than 2 steps. Please help me in solving this problem and that in the previous post.

Thanks,

Biju kuttan

0 Kudos
Message 6 of 9
(4,499 Views)
<under construction>


Message Edited by James Grey on 06-02-2008 02:17 PM
0 Kudos
Message 7 of 9
(4,486 Views)

Sorry, I forgot to mention that you also need to set the SequenceFileViewMgr.Sequence property to the sequence you are selecting. This property sets the 'focused item' in the sequences list while the SelectedSequences collection sets the 'selected list items'.

The step list displays the steps in the 'focused' sequence.

0 Kudos
Message 8 of 9
(4,481 Views)

Hi James,

It worked. Now the sequences are getting selected and the corresponding steps are visible. Thanks... Smiley Happy

Biju kuttan

0 Kudos
Message 9 of 9
(4,448 Views)