LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Find All Instances Scripting

Solved!
Go to solution

Hello, I was wondering if there was a way to programatically use the Find All Instances function with scripting?  At the moment my work around is very slow but works.  

I have a reference to a VI and I have my project open, I then want to find all the places that this VI is used.  At the moment I get all VIs in Memory (Application >> All VIs in Memory), then for each VI I get all SubVIs on the block diagram (Traverse References).  Then for each subVI in each VI in memory, I get the path to the VI and compare it to the path of the VI I want to find.

 

As one can imagine this takes too long.  Especially when I can right click my VI's Icon and say Find all Instances and get all 6 instances seemingly instantly.  I searched for a while and couldn't figure out if this was possible or how to do it.  Thanks.

 

Attached is my attempt, which just counts the number of times the search VI is called.

0 Kudos
Message 1 of 3
(2,542 Views)

I would try the following:

 

  1. Open a reference to the file you want to find its instances (it should be in memory)
  2. Get its callers using the Caller's Names property.
  3. Open all the callers.
  4. For each caller, traverse to find subVIs.
  5. For each subVI, check to see if it is the original VI.

Since everything is in memory already, I would expect this to take very little time.  I could be wrong, since I have not tried.

Message 2 of 3
(2,538 Views)
Solution
Accepted by topic author Hooovahh

Well that was easy, not sure why I didn't think of that.  In any case I made a new VI that does what you mention and it indeed works much faster.  Attached is the improved version in case someone was interested.

0 Kudos
Message 3 of 3
(2,521 Views)