Example Code

Search and open file 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

Description

1. Overview

Example VI that allows the user to make a file search in a certain folder, get a list of the files present in the folder and finally select to open one.

 

2. Description

This example code shows how to use event structures, subVI calls, and the browser library to show and open different files using LabVIEW. The project contains a main VI called “Search File”, which allows the user to select a folder to search for files, as well as a search criteria, in case there’s any.

It also includes an additional subVI called “Select File” which displays a given array of found files and waits for the user to click in one of them.

If there are no files to display, the program will display a message to the user.

 

3. Requirements

  • NI LabVIEW Base Development System 2012 (or compatible).

 

4. Steps to Implement or Execute Code

  1. Download the compressed file and open the project “Search and open file LabVIEW 2012 NIVerified.lvproj”
  2. Open the VI “Search File.vi”
  3. Run the VI.
  4. Select a Folder Address for the search.
  5. Write a Search Criteria, (use * as a wildcard)
  6. Press the Search button and select a file from the list.
  7. Press Stop when done.

 

5. Additional Information or References

 

Search and open file Screenshot.PNG

 

**The code for this example has been edited to meet the new Community Example Style Guidelines.**

Francisco Arellano

National Instruments Mexico
Field Systems Engineer - Energy Segment
www.ni.com/soporte

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