LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Detecting all VI's containing special elements

Hey,

 

I want to search all VI's in a folder and it's subfolders, containing a date-constant-element. What's the easiest way to do this programmatically?

 

Thanks

Elias

0 Kudos
Message 1 of 8
(2,510 Views)

Advanced file functions -> Recursive file list.

/Y

G# - Award winning reference based OOP for LV, for free! - Qestit VIPM GitHub

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 2 of 8
(2,488 Views)

In addition to what Yamaeda suggested, check this example:

SearchTimeConstant.png

I guess that a RelTimeConstants also exists.

 

 

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
Message 3 of 8
(2,467 Views)

@pincpanter wrote:

In addition to what Yamaeda suggested, check this example:

SearchTimeConstant.png

I guess that a RelTimeConstants also exists.

 

 


This is the right idea, but I believe the TopLvLDiag.AllObjs[] will only return top level objects - it won't return nested objects - items inside a case structure for instance. So you will need to recursively search each object for its nested objects. 

 

If you instead get the nodes from the top level diagram property, then attempt to cast each node to a structure, and if the structure cast doesnt fail get its diagrams then nodes recursively, you can get to every object in the vi. You could also use the Traverse for GObjects VI that is in the scripting pallete, if you have scripting enabled, but I recall it not always working correctly (or the way I wanted) and having to write my own in the past. 

Message 4 of 8
(2,456 Views)

You are right, Paul. Indeed, I wrote some time ago a small vi to hide an exceedingly large number of generic label of nodes (such as "Index Array", "Concatenate Strings" and so on) in a code written by a third-party contractor, which I found irritating (the labels, not the contractor). Here is my vi, used in a recursive way.

 

Hide generic labels.png

Paolo
-------------------
LV 7.1, 2011, 2017, 2019, 2021
0 Kudos
Message 5 of 8
(2,449 Views)

The best way to inspect VIs is to write a VI Analyzer test. I just published a Find Constant By Class Name test that should do what you're looking for.

 

Also, as far as the advice in this thread about how to find objects, you should use Traverse for GObjects.vi, which will find nested objects inside containers. It's easier than trying to parse containers yourself with AllObjs[].

0 Kudos
Message 6 of 8
(2,437 Views)

Implementing Darren's second-best option. Someday I'll get around to figuring out VI analyzer.

 

find_time_constants.png

0 Kudos
Message 7 of 8
(2,416 Views)

@Zwired1 wrote:

Someday I'll get around to figuring out VI analyzer.

 


When that day comes, start with this video. It's only 42 minutes, and is a comprehensive introduction to the VI Analyzer.

0 Kudos
Message 8 of 8
(2,414 Views)