06-05-2018 12:53 AM
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
06-05-2018 02:56 AM
Advanced file functions -> Recursive file list.
/Y
06-05-2018 07:45 AM
In addition to what Yamaeda suggested, check this example:
I guess that a RelTimeConstants also exists.
06-05-2018 09:03 AM
@pincpanter wrote:
In addition to what Yamaeda suggested, check this example:
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.
06-05-2018 09:44 AM
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.
06-05-2018 11:13 AM
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[].
06-05-2018 02:29 PM
Implementing Darren's second-best option. Someday I'll get around to figuring out VI analyzer.
06-05-2018 02:33 PM
@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.