LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

exclude files in dialog

I'm looking for a simple solution for excluding files in a file dialog.

 

The File Dialog Express VI allows us to specify one or more patterns, but patterns are not as powerful as regular expressions. If want to include files with "PCA" in the name, and exclude files with "PCA_Kills" in the name: The former is easy ("*PCA*"). The latter may not be possible. A regular expresion might look like:

 

*PCA(?!_Kills)*

 

Ideas?

 

 

_____________
Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 1 of 3
(2,630 Views)

That is beyond the express vi's capability as written. since it depends on the Browse options for the built in browse button witch implements a match pattern search for speed.

 

In theory, you could replace the browser itself and implement a regex in place of the match pattern.  However messing with things that deep under the hood tends to lead to mass confusion and the occasional violent reaction from a raving co-worker when his code doesn't work anymore.


"Should be" isn't "Is" -Jay
0 Kudos
Message 2 of 3
(2,617 Views)

I have found a solution to this problem in the case that the folder to be browsed is known in advance of the file dialog.

 

 

First, we need obtain a list of all the files in the folder of interest.

 

Next we filter these file names based on whatever criteria we wish (using string matching functions to include or exclude strings in the file names. For example, I might want to exclude all files that end in png and include all files that have the word Copy in the filename. THis is pretty easy, so I made an all-purpose file filtering VI.

 

Now we simply make a semicolon-delimited list of of the files that match our criterea and write that to the property Browse Options:Match Pattern for a path control or to the Pattern input of the File Dialog VI.

 

If the use moves out of hte initial directory, they will be confused as to why no files show up, so this solution really only works in very select instances. but it does work!

_____________
Creator of the BundleMagic plugin for LabVIEW!
0 Kudos
Message 3 of 3
(2,557 Views)