08-19-2008 06:38 AM
Hi All,
I have a opened more than one sequence file in the sequence editor. Now I would like to know, the way to get selected sequence file path or reference (I mean the tab) within my .NET code programmatically. The .Net code runs independently irrespective of the sequence file opened. So I would like to get the currently selected or visible sequence file in the TestStand 4.0.
Any suggestions are welcome...!!!
Thanks
Arun Prasath E G
08-20-2008 04:08 PM
Hello Arun Prasath E G,
Thank you for posting on the NI Discussion Forums. Performing this task from an instance of the TestStand Engine that you launch programmatically is an easy task, using the ApplicationManager.SequenceFiles class. Unfortunately that will not work for you, because you are trying to read the sequence files which are open in the TestStand Sequence Editor, which is its own application that has a different instance of the Application Manager opened. If you were to get a reference to the instance of the Application Manager that the Sequence Editor has opened, then the Sequence Editor would have to be a registered ActiveX Server, which it is not. As a result, the only option left is to use UI Messages to post from a sequence running in the Sequence Editor, using the same class mentioned above (ApplicationManager.SequenceFiles.Item.Path seems like the best option here). This is messy, as it will require you to have a sequence file always running on the Sequence Editor to send the UI Messages.
It sounds to me that you are using the Sequence Editor to actually run your test sequences (as an Operator Interface). Is this true? If so, I would highly recommend that you move to using an OI from the shipping examples <path here> or a customized one. Not only will this make it easier to find out what is loaded by the TestStand Application, but it will also create less overhead (i.e. running an extraneous sequence just for the purpose of posting UI messages over and over).
08-20-2008 05:03 PM
I want to correct an error in the previous post. You can certainly get the ApplicationMgr. See http://forums.ni.com/ni/board/message?board.id=330&message.id=17162&query.id=114689#M17162.
Unfortunately, ApplicationMgr.SequenceFiles is not going to tell you which file tab has the focus in the sequence editor. In a UI you could use ApplicationMgr.GetSequenceFileViewMgr to get the one and only SequenceFileViewMgr in the application, you could then get the active file via the SequenceFileViewMgr.SequenceFile property. However, the sequence editor uses a separate SequenceFileViewMgr control in each file window (so you can view multiple files at the same time). There is currently no supported API to determine which sequence editor window has the focus.
However, if your code is being invoked from a tool menu sequence (and probably for model entry points as well), the SelectedFile property of the root sequence context would tell you which file has the focus.
I'll enter a suggestion to add something like ApplicationMgr.ActiveSequenceFileViewMgr and ApplicationMgr.ActiveExecutionViewMgr properties so that the editor can better publish its notion of the active document.