LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Is it possible to programmatically search for text?

In LabVIEW, I can open a top-level VI so that it (and all its dependencies) are loaded into memory, press CTRL+F, and type a string to search for. The dialog will then find all instances of the text on the block diagrams and front panels of all VIs in memory.

 

I am wondering if there is any way to perform this search programmatically, using invoke nodes, VI scripting, or otherwise?

 

For context, I have a number of different strings (let's say 100) that I would like to search for, and due to the size of my application, each search takes a long time (let's say 10 minutes). As such, I'd love to be able to automate this search process.

0 Kudos
Message 1 of 16
(4,122 Views)

Wait a minute, are you saying you have a VI (or multiple VIs) that require 10 minutes to do a Find for a Text string?  I've had some fairly large projects (a few hundred VIs all in memory at once) and the "search" part (as I recall) took a fraction of a minute.  Looking at all of them (Cntrl-G) could take minutes ... [Ha, ha, I just notice I started this Reply with "Wait a minute" ...].

 

Bob Schor

0 Kudos
Message 2 of 16
(4,114 Views)

Yes, I'm trying to search through a project with thousands of VIs 😛

0 Kudos
Message 3 of 16
(4,111 Views)

Ouch!  Sorry, I don't know how to do that, but I'll keep an eye out and will be very interested in the response to this question!

 

Bob Schor

0 Kudos
Message 4 of 16
(4,099 Views)

Well, there's an "All VIs in memory" node to start with.

 

Load each in turn.

 

First, look through the VI properties to get the VI description, name, etc.

 

Run "Traverse for GObjects" on each twice, once on the front panel and once on the block diagram.  Skip the block diagram for the controls.

 

Then iterate through all of the GObjects to find the various caption, label, data, and other fields.

 

Then display all results.

 

Obviously I'm oversimplifying, but you could do it with enough time...

Message 5 of 16
(4,066 Views)

Regarding the search you can check "More options" to avoid searching through stuff if you know it's not there, like not searching front panels or descriptions. It'll improve times.

/Y

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

Qestit Systems
Certified-LabVIEW-Developer
0 Kudos
Message 6 of 16
(4,038 Views)

@Bob_Schor wrote:

Wait a minute, are you saying you have a VI (or multiple VIs) that require 10 minutes to do a Find for a Text string?  I've had some fairly large projects (a few hundred VIs all in memory at once) and the "search" part (as I recall) took a fraction of a minute.  Looking at all of them (Cntrl-G) could take minutes ... [Ha, ha, I just notice I started this Reply with "Wait a minute" ...].


I have that too. Not 10 minutes, but 3-5 minutes easily.

 

The problem is not the number of VIs per se. LabVIEW (still) searches data as well. What I mean is this. In my program I have several pixmap constants. Every text search takes forever, as the pixmap data is searched as well. And that search is completely redundant, as it will never find text results in the pixmap. I've tried hard to make the bytes in the pixmap match my text to find, but it simply never does.

 

A waste of search time, AFAIK, but the response when I reporting this wasn't very supportive (something like "we don't have this problem, what you do is weird, too much effort to change it").

 

You can try this yourself. Simply load a jpg with "Read JPG FIle.vi" and add an indicator. Run the VI, filling the indicator. Then do a text search. If the jpg is reasonably large (200 kb) the search will take forever. Of course, normally the VI will be a sub VI, and the indicator won't retain it's data, unless the VI is open when run. But if you change the indicator to a constant, the same happens.

 

 

0 Kudos
Message 7 of 16
(4,016 Views)

I doubt you would want to have 1K files open. I would use a directory search approach.

Expanding on a previous post...

 

LV Object Ref.png

---------------------------------------------
Former Certified LabVIEW Developer (CLD)
0 Kudos
Message 8 of 16
(3,998 Views)

I have similar issue.  I would appreciate knowing a work around too.

 

0 Kudos
Message 9 of 16
(3,959 Views)

@Mark_L wrote:

I have similar issue.  I would appreciate knowing a work around too.


The workaround is still:

Get a list of VIs (either VIs in memory or from a directory hierarchy, or whatever)

 traverse the FP for GObjects

 traverse the BD for GObjects

  for each object, get all properties that contain text

  for each object, get all references that contain text

 

More or less, all recursively of course. A lot of work, terrible code and error prone.

 

I'd personally go for a more 'automated' variant. First, script a VI that can get property values and property types per class, then use that to get all text properties from a reference. So script the 'get text' scripting', if you will. Less more work, but more difficult...

 

I am working on things like this, but it could take month, years before it's finished. I have paid work to do. When I'm done I might not remember to post it here.

0 Kudos
Message 10 of 16
(3,951 Views)