LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 
Reply

VI scripting to read block diagram comments

Solved!
Go to solution

Hi folks,

 

I have a little project to try and harvest comments from the block diagram, perhaps using VI scripting. So for example, when I'm checking #ToDo comments, I can get a list of the VI's that the #tag appears in and collect the text. I think I have found the method to get to the comment, but I'm not sure how to actually retrieve the text inside the comment. Below is a picture of how to get to the comment in the block diagram (just using this VI as a little example)

Part of  the BD comment solution?

 

Thanks for your help!

 

Rik

0 Kudos
Message 1 of 5
(1,566 Views)

Here is what you want. It should be noted that the current code only outputs the comment outside the case structure because you'll need to dive in to the structure(s) for anything inside it.

Get Text Decorations.png

Cheers

CLASolidWorks CP Icon.png
--------,       Unofficial Forum Rules and Guidelines                                           ,--------

          '---   >The shortest distance between two nodes is a straight wire>   ---'

Message 2 of 5
(1,562 Views)
Solution
Accepted by topic author rik_aspinall
08-27-2015 04:09 PM

@James.M wrote:

Here is what you want. It should be noted that the current code only outputs the comment outside the case structure because you'll need to dive in to the structure(s) for anything inside it.


Yes this code will traverse all GObjects but I'm pretty sure there is a bookmark manager API that will return bookmark comments if that is all you are looking for.

 

Example_VI_BD.png

 

EDIT:  Okay there is a invoke node that returns bookmark info on a VI reference but the VI can't currently be running.


Unofficial Forum Rules and Guidelines - Hooovahh - LabVIEW Overlord
Interesting in learning all you can about automotive CAN bus communication? Checkout my 12 part CAN Blog series.

Message 3 of 5
(1,531 Views)

As Hooovahh showed, using the Traverse for GObjects function will recursively find objects inside of structures.  If you have a lot of SubVIs that you also want to search for comments, you can first find the paths to all VI dependencies then individually traverse each VI for comments using the Get VI Dependencies Invoke Method

 

http://zone.ni.com/reference/en-XX/help/371361L-01/lvprop/vi_get_vi_dependencies/

 

 

Matt J
National Instruments | CLA
Message 4 of 5
(1,493 Views)

As ever lots of useful replies! Thanks for all of your help. I suggest that hoovah's answer is the best not only because it works on VI's that are already open but also it gets text inside subdiagrams. Also it probably has some error checking built in to check the cast to Text is good.

0 Kudos
Message 5 of 5
(1,479 Views)