LabVIEW

cancel
Showing results for 
Search instead for 
Did you mean: 

Script for removing comments in entire project

Solved!
Go to solution

I'd like to know if there is a way to automatically remove all "free floating" comments  in a LabVIEW project and all it's SubVis, ignoring of course the VI lib. I would like it to include comments inside of structures like Case diagrams, Sequence structures etc. By "free floating" I am referring to  comments where you just click on a block diagram and just start typing. Thanks!

0 Kudos
Message 1 of 16
(5,071 Views)

@EduNI wrote:

I'd like to know if there is a way to automatically remove all "free floating" comments  in a LabVIEW project and all it's SubVis, ignoring of course the VI lib. I would like it to include comments inside of structures like Case diagrams, Sequence structures etc. By "free floating" I am referring to  comments where you just click on a block diagram and just start typing. Thanks!


I don't think that's a very good idea at all.  The labels weren't put in there because the developer had a lot of free time to waste.  They are there to describe something!  What I would do is handle each free label as you come upon them while you are updating something else.  Don't automatically delete them, but read them and then decide where the label should go.  I can guarantee that you won't want to delete 99.9% of the free labels.

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
Message 2 of 16
(5,024 Views)

Thanks for weighing in. I am the developer in this case. I am well aware of the merits of comments in code. However, it doesn't change my task at hand. 🙂

0 Kudos
Message 3 of 16
(5,003 Views)

In anticipation of wanting to delete my personal notes to myself I usually preface them with some searchable string, i.e. *** pwm     (my initials). Then you can use the "Find and Replace". Not sure with other free floating strings.

Putnam
Certified LabVIEW Developer

Senior Test Engineer North Shore Technology, Inc.
Currently using LV 2012-LabVIEW 2018, RT8.5


LabVIEW Champion



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

@EduNI wrote:

Thanks for weighing in. I am the developer in this case. I am well aware of the merits of comments in code. However, it doesn't change my task at hand. :-). 


Comments will not effect the execution.  So,. Unless they are known to be in error, modify but don't delete.  Heck, a good percentage of my bds have a "``" comment

 

I don't auto tool.  Tab tab sometimes comes out as an unexpected​ comment

 

Shift 3 works neetly for Putnams notes to self.


"Should be" isn't "Is" -Jay
0 Kudos
Message 5 of 16
(4,988 Views)
Solution
Accepted by topic author EduNI

While I agree with everyone saying that doing this isn't exactly a good idea...  you didn't come here asking for my opinion.

 

I believe "Traverse for GObjects" is what you are looking for.  If I recall, the class name for comments is just "Text" - though I also believe this won't catch structure comments.

 

Unrelated, I've recently become a huge fan of using bookmarks.  I can make notes to myself, keep a clear TODO list, manage my custom error codes, etc.

 

Edit:  Something like this

bad idea.png

Message 6 of 16
(4,963 Views)

If you have a later version of LabVIEW, you can use bookmarks in the future.  Then you can just go and delete the bookmarks when you are done.  I have a ton of #ToDo bookmarks in one my projects, for instance.  😄

 

Bookmarks are so useful - I've even seen them used as a requirements matrix of sorts.

 

Sorry about the "words of wisdom" earlier.  If I have no idea of the developer's experience level, I always assume a level of 0.  Your original post sounded like it could've been written by an inexperienced developer about to tie the noose around their neck and jump off the platform willingly.  😉

Bill
CLD
(Mid-Level minion.)
My support system ensures that I don't look totally incompetent.
Proud to say that I've progressed beyond knowing just enough to be dangerous. I now know enough to know that I have no clue about anything at all.
Humble author of the CLAD Nugget.
0 Kudos
Message 7 of 16
(4,946 Views)

@BowenM can you post as LabVIEW 2015? Although I could manually enter the contents of the For loop quite easily, I am not sure how to get the "All VIs in Project" reference that feeds it.

Everyone: Thanks for all the fervent support of commenting code. 🙂 I feel equally strong in this regard. However, I feel I should explain my need further.  I have a situation where my company is "forced" to give up the code for a project.  We are doing so reluctantly. Since we cannot back out of the agreement we would like to provide the code with as little additional support as we can. We could obfuscate the VI names but that would likely cause additional conflict. And yes, some (not all) of the comments are "#CodeRecommended" and #CodeNeeded" bookmarks from the use of LabVIEW Sample Project code. 🙂   It is not an ideal situation but it is what it is. Thanks again for the support and feedback.

Message 8 of 16
(4,899 Views)

ProjectItems.pngMy better-half used to have a sign hanging in her cube that read...

 

"Real men don't document. If it was hard to write it should be hard to understand."

 

Ben

Retired Senior Automation Systems Architect with Data Science Automation LabVIEW Champion Knight of NI and Prepper LinkedIn Profile YouTube Channel
Message 9 of 16
(4,874 Views)

This might be helpful

"If you weren't supposed to push it, it wouldn't be a button."
Message 10 of 16
(4,861 Views)