NI TestStand Idea Exchange

cancel
Showing results for 
Search instead for 
Did you mean: 
StephenGerads

Support use of relative path for image file pathname in message popup step options.

Status: Already Implemented
This request is already implemented as mentioned by dug9000. Changing status to Already Implemented until we get more details from Stephen on further details of this request. Thanks!

Support use of relative path for image file pathname in message popup step options.

Relative paths make reuse and maintanence easier for me.

Image file pathnames are the only part of my code that breaks when I rename my project directory.

14 Comments
Jervin Justin
NI Employee (retired)

While I don't disagree that this is a good idea, juat as an FYI, one option would be to import the image into the step itself (File Source >> Step). However, this does of course reduce code reusability a little.

Jervin Justin
NI TestStand Product Manager
Scott_Richardson
Active Participant

The step type already supports relative paths by using the search directories, so if the image file is in the same directory as the sequence file, and default search directories settings are used, the file will be found at run-time. Can you clarify what additional options that may be wanted for this ideas exchange item?

 

.screenshot.png

Scott Richardson
https://testeract.com
Jeroen_Oortwijn
Member

It would be nice to simply use 

images\expansion_module\connect_wires.jpg

 as the File Pathname.

 

For now, I'm using the "File By Expression" with the following expression: 

Left(RunState.SequenceFile.Path, Find(RunState.SequenceFile.Path, "\\", 0, False, True))  + "\images\expansion_module\connect_wires.jpg"

 

dug9000
NI Employee (retired)

Jeroen,

 

As Scott said, it should already work exactly like you are asking (At least in recent versions of TestStand). If the path "images\expansion_module\connect_wires.jpg" is relative to the sequence file or one of the other search directories then that is all you need to specify. See the screen shot with Scott's post above for details.

Lars_L
NI Employee (retired)
Status changed to: Already Implemented
This request is already implemented as mentioned by dug9000. Changing status to Already Implemented until we get more details from Stephen on further details of this request. Thanks!
StephenGerads
Member

Hi Dug9000 and Scott

For popup image paths, relative paths like "images\wires.jpg", do not work as they do in every other case. WHY?

Of course, if the file is in a search path, and you specify as "wires.jpg", TestStand finds it.

I strictly avoid adding paths to the Search Directories because I want to avoid using any file from an unintended location. I like to specify relative paths to each module. 

For popup image paths, I use something like Jeroen's solution, which is relative to SequenceFile.Path.

Regards,

Steve

dug9000
NI Employee (retired)

Relative paths for images should work the same way they do everywhere else in TestStand. You can specify folders too like you are wanting "images\wires.jpg". TestStand's algorithm is not restricted to simple file names. If your path is relative to the sequence file, then, with the default settings for teststand, it should work. If it's not working for you please provide more details and I will help you determine the cause.

 

Also, you might have some misunderstandings about how search directories work. Please see the following forum thread for more details (especially my posts near the end):

 

http://forums.ni.com/t5/NI-TestStand/Why-TS-searches-the-directories-for-LV-modules-called-using/td-...

 

StephenGerads
Member

dug

I agree that "Relative paths for images should work the same way they do everywhere else in TestStand."

But they don't; I wish they did; that is the point of this idea.

 

StephenGerads
Member

For other steps, I can select relativepath: relative.png

 

For Message Popup steps using file in relative subdirectory I do not get that option:

noRelative.png

 

notFound.png

It seems to find it at runtime though.

 

 

dug9000
NI Employee (retired)

What version of TestStand are you using? Did you perhaps remove or disable the search directory for the "Current sequence file directory"? I am not able to reproduce this problem.