Quick Drop Enthusiasts

cancel
Showing results for 
Search instead for 
Did you mean: 

Search for Shared Variable

I was looking to create a quick drop to search my project for calls to a shared variable.  I believe that I would need to search the project by the variable's name to find the point-of-use within VIs.

 

My first attempt can see that it is a shared variable, but I can't find a way to get it's name.  At the very minimum, I would like to copy the name to the clipboard.

0 Kudos
Message 1 of 17
(3,389 Views)

You can read the Label.Text property of the Shared Variable node. It will always be the target namespaced name of the variable, like "My Computer\abc.lvlib\Variable1".

 

Also, you should consider implementing this feature as a Right-Click plugin instead of a Quick Drop plugin, since right-click plugins are more suitable for more context-sensitive operations, like operating only on certain objects.

0 Kudos
Message 2 of 17
(3,387 Views)

As an alternative you could just do a text search for the name of the shared variable using the search window that already exists.  Just "CTRL+F".  Works really well.  I had to re-architect an application with hundreds of shared variables and got through it that way.

0 Kudos
Message 3 of 17
(3,381 Views)

wrote:

As an alternative you could just do a text search for the name of the shared variable using the search window that already exists.  Just "CTRL+F".  Works really well.  I had to re-architect an application with hundreds of shared variables and got through it that way.


That is a great tip!  The end result is what I was hoping to achieve.  This is likely to be my final solution.

0 Kudos
Message 4 of 17
(3,365 Views)

wrote:

You can read the Label.Text property of the Shared Variable node. It will always be the target namespaced name of the variable, like "My Computer\abc.lvlib\Variable1".



That is what I was looking for.  If I just use GObj, I can only get the class name.  If I cast it to a Variable, Label.Text isn't available.  If I cast it to a control, Label.Text is there, but doesn't show anything.

0 Kudos
Message 5 of 17
(3,366 Views)

I was referring to the Label.Text property of the SharedVariableNode class...I had assumed you were referring to shared variable nodes on the block diagram.

 

1.png

0 Kudos
Message 6 of 17
(3,356 Views)

wrote:

I was referring to the Label.Text property of the SharedVariableNode class...I had assumed you were referring to shared variable nodes on the block diagram.

 

1.png


OK, now I found it.  I just needed to enable VI Scripting to see it.

 

Now that I have the string I need, how would I pass it into "Find and Replace..." or go straight to "Search Results"?

0 Kudos
Message 7 of 17
(3,346 Views)

2ndTime wrote: 
 

Now that I have the string I need, how would I pass it into "Find and Replace..." or go straight to "Search Results"?


Unfortunately, there is no G interface to the Find and Replace feature.

0 Kudos
Message 8 of 17
(3,339 Views)


Unfortunately, there is no G interface to the Find and Replace feature.


OK, thanks for the info.  I appreciate it.

0 Kudos
Message 9 of 17
(3,336 Views)

One workaround I've employed is to use the VI Analyzer to write a test that not only finds particular objects, but also uses scripting to modify the VI. I talk about this technique and give a demo toward the end of my VI Analyzer presentation.

0 Kudos
Message 10 of 17
(3,334 Views)