Example Code

Check Input String for File/Path in LabVIEW

Products and Environment

This section reflects the products and operating system used to create the example.

To download NI software, including the products shown below, visit ni.com/downloads.

    Software

  • LabVIEW

Code and Documents

Attachment

Overview

Coding that exemplifies how to verify if an Input String contains a path or a file name.

 

Description

This VI verifies if an Input String contains a path to a folder, a path to file, both or none. It uses a combination of cases structures and it searches special characters that are contained within a path to a folder or a file. It searches the character “/” for identifying if it has a reference to a folder and the character “.” for identifying if it has a file name.

 

The code can identify if both the path and the file name are or not present. Depending on the results of the search it can pop up a dialog with one of the following four messages:
1. Filename
2. Path
3. File name and path
4. No file name or path

 

Requirements

LabVIEW Base Development System.

 

Steps to Implement or Execute Code

1. Load the attached VI named “Check Input String for Path-File LV 2012 - NI Verified.vi” as a subVI.
2. Be sure to place a valid string in Input String control.
3. Run the VI.

 

Additional Information or References

 Code Snippet 9249.png

**This document has been updated to meet the current required format for the NI Code Exchange.**

A_Ryan
AES
National Instruments

Example code from the Example Code Exchange in the NI Community is licensed with the MIT license.