NI TestStand

cancel
Showing results for 
Search instead for 
Did you mean: 

Open File dialog window when setting the value of a path type input argument in a VI call

Hi,

 

I am new to TestStand (running 4.0) and I want to create a sequence of VIs to turn on, setup and measure a device. One of my VIs sends a configuration file to my device. An input argument to this VI is the path of the config file. I would like to make it simple to modify this path when setting up the sequence by popping up the File Open dialog window and choose my file. Is this possible? I do not want to manually change the file during execution, just to have multiple calls of one VI, each call opening a different file according to the path given to it during the setup. 

 

So far I have only succeeded in manually entering the absolute path each time I add this step. What makes it even more annoying is the fact that LabVIEW interprets the path with the escape codes, rendering the path unusable. Manually adding a 2nd backslash at each '\' occurence adds another step to the process. I tried both String and Path type of inputs, and the SearchandReplace() or ToUpper() (trying to bypass the escape codes) functions in TestStand don't seem to help m.

 

Your help is very much appreciated,

Fred

0 Kudos
Message 1 of 9
(5,121 Views)

Hi Fred,

 

There are a couple options here. 

 

1- Since you have 4.0 you can call API methods from an Expression Step.  There is an API call Engine.DisplayFileDialog method.  This will return two string arrays.  One is called SelectedPaths the other is called AbsolutePaths.  If you create a Local variable that is an array of strings you can use that as the AbsolutePaths parameter.  Then access the first element of this array and you will have the path to the file.

 

2- Create a VI that calls the File Dialog Express vi.  Or call it directly from TS as a LabVIEW Action step.  This returns the path.  You can convert it to a string.  If you call it directly from TS then you can just put in a string variable for the return path and it automatically converts for you.  The advantage to calling it from within a VI is that you can make it modal to TS using the TS modal vis.  That way it will always pop up in front.

 

Hope this helps some.  Let me know if you have ?s.

 

Regards,

Message Edited by ~jiggawax~ on 01-20-2009 01:53 PM
jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 2 of 9
(5,118 Views)

Hi Jigg,

 

Thanks for your reply. I tried what you said and although now I know how to use API calls, my problem still persists. I think it has to do with the way I explained it.

 

I would like other engineers to be able to create their own sequences with very little knowledge of TS. As they would add the 'program the part' step in the sequence creation, they would be prompted to specify the location of the file. Because the setup is highly automated, I cannot have the user choose the file when the sequence is running, it has to be chosen before and remain 'static'

 

Basically instead of manually typing a path in the value field I would like to popup the File Open dialog box. Such as the icon in the red circle in this image:

 

FileOpen

 

As I learn more and more about TS, I realize that this might be impossible. 

 

Thank you very much your help

 

 

Message Edited by Eudaemonic on 01-26-2009 01:50 PM
0 Kudos
Message 3 of 9
(5,061 Views)

If I understand you correctly you want to have a collection of VIs that you will be calling and you want to make it so creating a sequence using this collection is releatively easy. 

 

The easy solution here would be to set up all the steps yourself and then drag them to the Templates under Steps.  Then when you create the sequence you will just have to drag templates into it and everything is set up for you. 

 

Am I seeing this correctly?

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 4 of 9
(5,056 Views)
Another possibility is to create a VI that acquires the path using the File Dialog express VI and place an action step in your Setup that acquires the path and writes it to a local of type path. The VI could be as simple as the one I have attached (I saved it in LabVIEW 8.2). Is that close to what you are looking for?
0 Kudos
Message 5 of 9
(5,037 Views)

Thank you Corbin and Jigg for your help. From what I understand form your suggested solutions, the user would have to select the file during run-time, when the seuence reaches the 'open file' step.

 

What I am looking for is a way to select the path to the file when I create the sequence. Right now I can only do it by typing the actual path in the value field in the module tab of the configuration of the action step. (see attached image in my previous post). When I manually type a path, I also have to use the double backslash because otherwise labview interprets the string as having escape codes. This is not exactly user-friendly :smileysad:

 

I want some of my collegues to be able to particapate in creating a huge sequence that would automatically (and without user intervention) test our design. I would like to simplify this creation step by having access to the file dialog box when the parameter type is a path. 

 

If I can take an example, if an input to a VI is a enum type, TestStand will create a drop-down box so that you can easily choose the value of this input. See image where parameter 'Communication' is set to 'I2C'.

 

I hope my explanation makes a bit more sense, I am not very good at putting my ideas into words!

 

Thank you so much once again,

Fred

0 Kudos
Message 6 of 9
(5,033 Views)

My post was dealing with design time and not runtime.  Templates are a quick way to use the same steps over and over without having to retype everything.

 

As for the browse button like your image-  Currently this isn't possible with the default Sequence Editor.  However, you may be able to create this functionality with a custom Sequence Editor.  Although, I'm not so sure this feature merits creating a whole new sequence editor.  Not to mention you would need a license for it unless you have one already.

 

I think this would be an excellent product suggestion if you feel like doing so: http://digital.ni.com/applications/psc.nsf/default?OpenForm

 

Good luck,

jigg
CTA, CLA
testeract.com
~Will work for kudos and/or BBQ~
0 Kudos
Message 7 of 9
(5,029 Views)

Eudaemonic,

 

If you want to create a series of easy to configure step types so others can develop sequence files easily, you could use custom step types. When you create a custom step type you implement your own configuration dialog. Since you have control over what controls you expose in your configuration dialog, you can design it so the desired path is selected using a open file dialog. Refer to chapter 13 of the TestStand reference manual for more information about custom step types.

If you do not want to create a custom step type but you still want to give access to your sequence developers to pre-configured steps, you can use templates. A step template is a snapshot of a step that you can reuse later. Let's assume that instead of asking your users to edit the step to enter the desired path, you create several step templates with different pre-configured paths and based on their applications requirements they could use the appropriate template. Refer to the NI TestStand Help for more information about the Templates list on the Insertion Palette.

 

Hope it helps.

 

Antonio Lie.

 

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

Eudaemonic,

 

One other thing that you can do with custom step types is have a code module run when a new step is created.  You do this by creating a custom step type with the name "OnNewStep".  See this Knowledgebase for more information: http://digital.ni.com/public.nsf/allkb/D94132BADCCAAD7D862572AE00741915?OpenDocument

 

Josh W.
Certified TestStand Architect
Formerly blue
0 Kudos
Message 9 of 9
(4,945 Views)