LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

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
(4,286 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


--------,       Unofficial Forum Rules and Guidelines                                           ,--------

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


Message 2 of 5
(4,282 Views)
Solution
Accepted by topic author rik_aspinall

@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.

Message 3 of 5
(4,251 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
(4,213 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
(4,199 Views)