| View previous topic :: View next topic |
| Author |
Message |
Amy Guest
|
Posted: Fri Feb 02, 2007 1:11 pm Post subject: Auto deleting code comments |
|
|
I am wondering if someone can help me assemble a basic script cleanup program to clean code comments faster, where upon detecting a code comment appendage ; will delete the rest of the line. Comments at the end of a line, could be detected and wiped?
x = 1 ; this is a varable <- delete ; and everything after
IT will be massive help to have a efficent script cleaner.
 |
|
| Back to top |
|
 |
ahklerner
Joined: 26 Jun 2006 Posts: 1205 Location: USA
|
Posted: Fri Feb 02, 2007 1:17 pm Post subject: |
|
|
| comments are your friend. |
|
| Back to top |
|
 |
JSLover
Joined: 20 Dec 2004 Posts: 542 Location: LooseChange911.com... the WTC attacks were done by the US Gov't... the official story is a lie...
|
Posted: Fri Feb 02, 2007 1:19 pm Post subject: Re: Auto deleting code comments |
|
|
I wrote a script to clean my "debug" comments, but it could easily be modified to clean all comments (well it doesn't support multi-line comments yet)...I'll work on it & post it... _________________
Home • Click image! • Blog |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Fri Feb 02, 2007 1:43 pm Post subject: |
|
|
| ahklerner wrote: | | comments are your friend. | Yes. Deleting comments will bring no improvement of the script, so why doing this?
JSLover's clean up of some kind of comment has sense, but not blind clean up.
In all cases, it is probably a matter a FileRead, RegExReplace, FileDelete and FileAppend, so around 4 or 5 lines... _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
majkinetor
Joined: 24 May 2006 Posts: 3626 Location: Belgrade
|
Posted: Fri Feb 02, 2007 4:46 pm Post subject: |
|
|
script cleaner
you mean , scrip obfuscator
Thre should be top of the line warning at the first page with text
DO NOT DELETE COMMENTS, EVER _________________
 |
|
| Back to top |
|
 |
Amy Guest
|
Posted: Sun Feb 04, 2007 4:08 am Post subject: |
|
|
I agree with what you say, but I like to remove comments in some tight security applications. My original question still stands, and just curious. IT seems the official decompiler AHK program actually strips code comments upon de-compiling using a password? I am a little confused there can someone clairfy? My question I guess is -- once a AHK executable is defined, can those code comments be seen -- or am I wasting my time manully removing them in-between .exe builds.  |
|
| Back to top |
|
 |
wtg
Joined: 04 Oct 2006 Posts: 63 Location: Louisville, KY
|
Posted: Sun Feb 04, 2007 4:44 am Post subject: |
|
|
| As I understand it the compiler strips out the comments when it makes the .EXE, so no fear, they're gone. However, if you really need know, compile your program and then decompile it. |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Sun Feb 04, 2007 4:46 am Post subject: |
|
|
| Amy wrote: | | My question I guess is -- once a AHK executable is defined, can those code comments be seen -- or am I wasting my time manully removing them in-between .exe builds. |
Don't worry about it. Whether you give it a password or not, comments are always removed. In fact, most people see this as a disadvantage.
| The documentation wrote: | | An EXE can be decompiled to retrieve the original script by downloading Exe2Ahk (this utility should be run from the command prompt). However, any comments originally present (semicolon or /**/) will be lost. |
|
|
| Back to top |
|
 |
Amy Guest
|
Posted: Sun Feb 04, 2007 7:34 am Post subject: |
|
|
Well, that clears it all up. So, to re-affirm and confirm here, AHK by *default* will strip out all code comments  |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Sun Feb 04, 2007 7:36 am Post subject: |
|
|
Yes, Ahk2Exe will. Technically, AutoHotkey itself does too, but... does that really matter?  |
|
| Back to top |
|
 |
Amy Guest
|
Posted: Sun Feb 04, 2007 7:37 am Post subject: |
|
|
An EXE can be decompiled to retrieve the original script by downloading Exe2Ahk (this utility should be run from the command prompt). However, any comments originally present (semicolon or /**/) >> will be lost <<.
"Will be lost", is technically a little unclear then as that stands to read. Right? Maybe Chris can confirm. The way it read to me, it sounds like it presumes the comments will be lost because of the decompiling. Are they still in there? ARE YOU SURE??  |
|
| Back to top |
|
 |
jonny
Joined: 13 Nov 2004 Posts: 3004 Location: Minnesota
|
Posted: Sun Feb 04, 2007 7:38 am Post subject: |
|
|
| Ahk2Exe behaves much the same way AHK itself does. That is, it completely disregards comments as irrelevant to parsing the code. So yes, they will be lost. Try it yourself if you're still unconvinced. |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Sun Feb 04, 2007 10:13 am Post subject: |
|
|
As wtg already said, the compiler strips out the comments when it creates the executable.
There are no comments in the EXE. Thus they can not be retrieved. _________________ Ciao
toralf  |
|
| Back to top |
|
 |
|