Block Code Commenting Script

Help with writing and running scripts

Block Code Commenting Script

Postby codebox_rob » Sun Mar 01, 2009 7:24 am

I've written a script for commenting out multiple lines of code at a time - it detects what language you are using from the file extension, and then adds a comment symbol at the start of each selected line. If the selected lines are already commented out then they are uncommented, so it lets you toggle comments on/off as needed. Languages supported include Java, JavaScript, PHP, C-Sharp, Perl, Ruby, UNIX Shell, and VB - it can also comment out sections of an XML/HTML document.

Its a bit long to post here, but you can download it from http://codebox.no-ip.net/controller?page=misc.UeBlockComment
codebox_rob
Newbie
 
Posts: 2
Joined: Sun Mar 01, 2009 7:07 am

Re: Block Code Commenting Script

Postby mjcarman » Tue Mar 03, 2009 9:17 am

Does this do something that the built-in Comment Add and Comment Remove commands don't?
User avatar
mjcarman
Power User
Power User
 
Posts: 125
Joined: Thu Feb 10, 2005 12:00 am

Re: Block Code Commenting Script

Postby codebox_rob » Tue Mar 03, 2009 1:42 pm

mjcarman wrote:Does this do something that the built-in Comment Add and Comment Remove commands don't?

Well I never knew about that feature, just found it now - thanks for the heads-up. Luckily, the answer is yes! The script copes better with commented lines that don't have the comment character/s at the very start of the line - it will remove comments even if the comment is preceded by whitespace. It also works for blocks of HTML/XML which I dont think the built-in feature does. Also, since its open-source and (I hope) fairly clearly written you can add in your own commenting code to process things differently if you want. If none of those advantages are important to you then I say just use the native feature, since its probably more robust than mine.

Rob
codebox_rob
Newbie
 
Posts: 2
Joined: Sun Mar 01, 2009 7:07 am

Re: Block Code Commenting Script

Postby maryv » Wed Mar 11, 2009 10:39 am

Thanks for the script! Great to see contributions for UE community benefit!
User avatar
maryv
Basic User
Basic User
 
Posts: 26
Joined: Wed Mar 21, 2007 11:00 pm


Return to Scripts