AutoHotkey Community

It is currently May 24th, 2012, 5:27 pm

All times are UTC [ DST ]




Post new topic Reply to topic  [ 13 posts ] 
Author Message
PostPosted: February 2nd, 2007, 1:11 pm 
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. :) :) :)
:? :D


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 2nd, 2007, 1:17 pm 
Offline

Joined: June 26th, 2006, 6:14 pm
Posts: 1379
Location: USA
comments are your friend.


Report this post
Top
 Profile  
Reply with quote  
PostPosted: February 2nd, 2007, 1:19 pm 
Offline
User avatar

Joined: December 20th, 2004, 12:19 pm
Posts: 794
Location: LooseChange911.com Ask Questions, Demand Answers █ The WTC bldgs █ shouldn't have fallen █ that fast
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...

_________________
AutoHotkey-Hotstring.ahk - Helping the world spell "AutoHotkey" correctly! (btw, it's a lowercase k!)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 2nd, 2007, 1:43 pm 
Offline

Joined: December 27th, 2005, 1:46 pm
Posts: 6837
Location: France (near Paris)
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...

_________________
Image vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2")


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 2nd, 2007, 4:46 pm 
Offline

Joined: May 24th, 2006, 2:49 pm
Posts: 4511
Location: Belgrade
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

_________________
Image


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2007, 4:08 am 
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. :)


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2007, 4:44 am 
Offline

Joined: October 4th, 2006, 2:15 am
Posts: 250
Location: Louisville, KY
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2007, 4:46 am 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2007, 7:34 am 
Well, that clears it all up. So, to re-affirm and confirm here, AHK by *default* will strip out all code comments :arrow: :arrow: :D


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2007, 7:36 am 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
Yes, Ahk2Exe will. Technically, AutoHotkey itself does too, but... does that really matter? :)


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2007, 7:37 am 
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?? :P


Report this post
Top
  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2007, 7:38 am 
Offline

Joined: November 13th, 2004, 4:08 am
Posts: 2951
Location: Minnesota
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.


Report this post
Top
 Profile  
Reply with quote  
 Post subject:
PostPosted: February 4th, 2007, 10:13 am 
Offline

Joined: January 31st, 2005, 9:50 am
Posts: 3910
Location: Bremen, Germany
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
Image


Report this post
Top
 Profile  
Reply with quote  
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 13 posts ] 

All times are UTC [ DST ]


Who is online

Users browsing this forum: KenC, Klark92, Ohnitiel, Pulover, Rathgar2 and 53 guests


You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Powered by phpBB® Forum Software © phpBB Group