AutoHotkey Homepage AutoHotkey Community
Let's help each other out
 
 FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Auto deleting code comments

 
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help
View previous topic :: View next topic  
Author Message
Amy
Guest





PostPosted: Fri Feb 02, 2007 1:11 pm    Post subject: Auto deleting code comments Reply with quote

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. Smile Smile Smile
Confused Very Happy
Back to top
ahklerner



Joined: 26 Jun 2006
Posts: 1205
Location: USA

PostPosted: Fri Feb 02, 2007 1:17 pm    Post subject: Reply with quote

comments are your friend.
Back to top
View user's profile Send private message
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...

PostPosted: Fri Feb 02, 2007 1:19 pm    Post subject: Re: Auto deleting code comments Reply with quote

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
View user's profile Send private message Visit poster's website
PhiLho



Joined: 27 Dec 2005
Posts: 6721
Location: France (near Paris)

PostPosted: Fri Feb 02, 2007 1:43 pm    Post subject: Reply with quote

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
View user's profile Send private message Visit poster's website
majkinetor



Joined: 24 May 2006
Posts: 3626
Location: Belgrade

PostPosted: Fri Feb 02, 2007 4:46 pm    Post subject: Reply with quote

script cleaner Question Confused

you mean , scrip obfuscator Exclamation

Thre should be top of the line warning at the first page with text


DO NOT DELETE COMMENTS, EVER
_________________
Back to top
View user's profile Send private message MSN Messenger
Amy
Guest





PostPosted: Sun Feb 04, 2007 4:08 am    Post subject: Reply with quote

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. Smile
Back to top
wtg



Joined: 04 Oct 2006
Posts: 63
Location: Louisville, KY

PostPosted: Sun Feb 04, 2007 4:44 am    Post subject: Reply with quote

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
View user's profile Send private message
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Sun Feb 04, 2007 4:46 am    Post subject: Reply with quote

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
View user's profile Send private message
Amy
Guest





PostPosted: Sun Feb 04, 2007 7:34 am    Post subject: Reply with quote

Well, that clears it all up. So, to re-affirm and confirm here, AHK by *default* will strip out all code comments Arrow Arrow Very Happy
Back to top
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Sun Feb 04, 2007 7:36 am    Post subject: Reply with quote

Yes, Ahk2Exe will. Technically, AutoHotkey itself does too, but... does that really matter? Smile
Back to top
View user's profile Send private message
Amy
Guest





PostPosted: Sun Feb 04, 2007 7:37 am    Post subject: Reply with quote

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?? Razz
Back to top
jonny



Joined: 13 Nov 2004
Posts: 3004
Location: Minnesota

PostPosted: Sun Feb 04, 2007 7:38 am    Post subject: Reply with quote

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
View user's profile Send private message
toralf



Joined: 31 Jan 2005
Posts: 3842
Location: Bremen, Germany

PostPosted: Sun Feb 04, 2007 10:13 am    Post subject: Reply with quote

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
View user's profile Send private message Send e-mail Visit poster's website
Display posts from previous:   
Post new topic   Reply to topic    AutoHotkey Community Forum Index -> Ask for Help All times are GMT
Page 1 of 1

 
Jump to:  
You can post new topics in this forum
You can reply to topics in this forum


Powered by phpBB © 2001, 2005 phpBB Group