 |
AutoHotkey Community Let's help each other out
|
| View previous topic :: View next topic |
| Author |
Message |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Fri Feb 03, 2006 7:27 am Post subject: Auto-Syntax-Tidy v12 |
|
|
Auto-Syntax-Tidy is for all those people like me and Hajos who get lazy with adjusting the indentation manually as it should be (for readability of the script).
changes since version 11:
- tray icon allows to toggle show/hide of GUI and to exit script
- added progressbar if identation is done inside an editor and blockinput is used to limit interference
- shortend code with functions, with new features the line numbers stay equal
- log text is scrolled to the end
- on /hidden, gui is created but hidden, tray icon is visible in both cases.
- on "/watch hwnd" , gui is hidden and closes itself when hwnd closes
- on /toggle, script checks if another instance is running and closes both scripts
- improved possibilty to find path of AHK
- added warning message if syntax files do not exist
- OwnHotkey is stored in INI file and has a control in the GUI
New features in v11:
- Command line options
- New style "BoBo"
New features in v10:
- 2 bug fixes (thanks philoh)
New features in v9:
- commands directly after Else are supported
- case correction of directives
New features in v8:
- OTB, so it is up to date with AHK 1.0.41.02
- special indentations for GUI,Tab
!!! caution !!! case correction is dangerous, since WinTitles in commands are case sensitive
This script features:
| Quote: | ; What it does:
; It takes a AHK script and changes the indentation and case of commands according to syntax.
;
; Known limitations:
; - a space is required after the last ":" for hotkeys, hotstrings and subroutine
; - comments might not have the right indentation in certain strongly
; encapsulated block-structures, due to not knowing what the next line will bring.
; - case correction only works for words longer than 4 characters,
; (except: (in all cases) If, Loop, Else
; (optional) Goto, Gui, Run, Exit, Send, Sort, Menu
; Parse, Read, Mouse, SendAndMouse, Default, Permit, Screen, Relative
; Pixel, Toggle, UseErrorLevel, AlwaysOn, AlwaysOff
; !!! caution !!! case correction is dangerous, since WinTitles in commands are case sensitive
;
; - after doing indentation in an editor the cursor jumps
; to the first position in the last line
; - Indentation might fail, if a "{" is the last character of a Loop or If statement that
; doesn't support OTB. E.g. "If x = {" or "Loop, Parse, Var, {"
;
; Functionality:
; - Gui: For drag&drop of files, setting of options and feedback
; - command line option "/in" for file and "/log" for log file
; - command line option "/hidden" to start script with hidden GUI
; - command line option "/watch hwnd" to start script with hidden GUI, closes itself when hwnd closes
; - command line option "/toggle" checks if another instance is running and closes both scripts
; - command line option "/hidden" to start script without GUI
; - Options:
; - custom hotkey for indenation
; - custom file extension (overwrites old file if nothing is specified)
; - custom indentation (one tab or a number of spaces)
; - different indentation styles (Rajat, Toralf or BoBo)
; - indentation of continuation lines (a number of tabs or spaces)
; - indentation preservation of block continuation lines (round brackets) On/Off
; - indentation preservation of block comments (/* ... */) On/Off
; - case correction for syntax words with more than 4 characters (thanks Rajat)
; - statistics for script (lines of code, comments, total and empty an time needed)
; - Dropped Files: Contents will be indented and copied to a new file with a user
; defined extension (overwrites old file if nothing is specified).
; - Hotkey (F2): Highlighted syntax in an editor will be indented, if nothing is
; highlighted all text will be indented. (thanks ChrisM)
; - Gui remembers last position and settings between sessions (thanks Rajat)
; - The case of subroutine calls and function calls is adjusted to the case
; of their respective definitions
; - Ctrl-d toggles debug mode
; - 12% faster then version 7 (due to shortened loop cycles) but 90 lines longer
;
; !!! Not heavily tested !!!! ---- !!!!!! Backup your data !!!!!
;
; Suggestions are appreciated
|
ScreenShot of GUI
The scripts own code has been indented with itself. So you get a nice impression on how it would look like if you use the settings of the GUI.
Since the code is now 1546 lines long (1098 command lines), I only provide the code as download: AHK source code
The script started to grow in a different but now old topic. It became too long, so I opened this new one. _________________ Ciao
toralf 
Last edited by toralf on Mon Sep 04, 2006 11:34 am; edited 7 times in total |
|
| Back to top |
|
 |
Chris Site Admin
Joined: 02 Mar 2004 Posts: 10464
|
Posted: Fri Feb 03, 2006 11:28 am Post subject: |
|
|
| Great user interface and documentation. |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Fri Feb 03, 2006 2:46 pm Post subject: |
|
|
Thanks _________________ Ciao
toralf 
Last edited by toralf on Wed Feb 08, 2006 1:34 pm; edited 1 time in total |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Wed Feb 08, 2006 1:33 pm Post subject: |
|
|
A new version v9 in the first post:
New features in v9:
- commands directly after Else are supported
- case correction of directives
!!! caution !!! case correction is dangerous, since WinTitles in commands are case sensitive
Please test your complicated scripts and report any wrongly indented code. Thanks _________________ Ciao
toralf  |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Tue Feb 21, 2006 8:52 pm Post subject: |
|
|
New version v10 in first post:
- 2 bug fixes (thanks philoh) _________________ Ciao
toralf  |
|
| Back to top |
|
 |
AHKnow* Guest
|
Posted: Thu Feb 23, 2006 6:30 am Post subject: |
|
|
Great Work!!!  |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5009 Location: imaginationland
|
Posted: Sat Mar 18, 2006 11:11 pm Post subject: |
|
|
I know this might be tricky to impliment but since you've made such a comprehensive parser I'll ask anyway. Would it be possible to add an optimization section - in here there could be things like comment and indentation removers.. ? _________________
RegExReplace("irc.freenode.net/autohotkey", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Sat Mar 18, 2006 11:40 pm Post subject: |
|
|
Why would you want to do that? I remember that I had this discussion before, and I think the result was, that it doesn't improve much, besides some kB on your harddrive for the scripts. Compiled scripts will not have it anyway.
BTW: To remove indentation can already be done.
Removing of comments and empty lines should be easy to implement, but would again add more controls to the GUI. _________________ Ciao
toralf  |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5009 Location: imaginationland
|
Posted: Sun Mar 19, 2006 12:13 am Post subject: |
|
|
Ah ok. Well here's something else... the GUI looks very uninviting, here's my suggestion on the frontend UI:
Download Static GUI Script (< 3kb) _________________
RegExReplace("irc.freenode.net/autohotkey", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
PhiLho
Joined: 27 Dec 2005 Posts: 6721 Location: France (near Paris)
|
Posted: Sun Mar 19, 2006 12:33 am Post subject: |
|
|
Titan: this is nice, but:
- this is just a guess, but maybe toralf prefers a compact GUI that matches his style of coding...
- you loose the "extension for files" functionnality, which is nice IMHO. I don't like the read-only edit fields for file path, like we see in the AHK compiler, because it doesn't allow pasting, and you have to open a dialog for the target where a simple "paste and correct name" could be enough.
- There is a regression on the placement of the edit box indicating the number of Tabs or Spaces to be used in continuation lines. With the style you used, we would believe it is a multiplier for spaces only. I was confused in the old version of Auto-Syntax-Tidy and toralf was kind enough to change that.
In both cases, I am not fan of the "Rajat vs. Toralf" style names... Those unfamiliar with these eminent members of our community would be confused, and "See the website for more details" isn't satisfying... _________________
vPhiLho := RegExReplace("Philippe Lhoste", "^(\w{3})\w*\s+\b(\w{3})\w*$", "$1$2") |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5009 Location: imaginationland
|
Posted: Sun Mar 19, 2006 12:47 am Post subject: |
|
|
| PhiLho wrote: | | - this is just a guess, but maybe toralf prefers a compact GUI that matches his style of coding... | It's standard programming/design practice to make something easy to use. It also needs to be simple and fool proof (KIS). At a glance toralf's GUI looks quite cryptic and it does not address either points in my opinion.
| PhiLho wrote: | | - you loose the "extension for files" functionnality | Remember that GUI is static. Toralf could make the save as field update with an extension automatically when the original file field is changed.
| PhiLho wrote: | | I don't like the read-only edit fields for file path | Me too, I should have made it editable.
| PhiLho wrote: | | - There is a regression on the placement of the edit box indicating the number of Tabs or Spaces to be used in continuation lines. With the style you used, we would believe it is a multiplier for spaces only. I was confused in the old version of Auto-Syntax-Tidy and toralf was kind enough to change that. | To be honest I don't even know what that does so I left it the way I saw fit.
| PhiLho wrote: | | In both cases, I am not fan of the "Rajat vs. Toralf" style names... Those unfamiliar with these eminent members of our community would be confused, and "See the website for more details" isn't satisfying... | I agree, I think it's horrible. My GUI is just a remake of the original, so it still has room for improvement. _________________
RegExReplace("irc.freenode.net/autohotkey", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Sun Mar 19, 2006 12:54 am Post subject: |
|
|
Please advice names for the two different styles. _________________ Ciao
toralf  |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5009 Location: imaginationland
|
Posted: Sun Mar 19, 2006 1:02 am Post subject: |
|
|
| toralf wrote: | | Please advice names for the two different styles. | I would if I knew what they were...  _________________
RegExReplace("irc.freenode.net/autohotkey", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
toralf
Joined: 31 Jan 2005 Posts: 3842 Location: Bremen, Germany
|
Posted: Sun Mar 19, 2006 1:27 am Post subject: |
|
|
test both and you'll see the difference. _________________ Ciao
toralf  |
|
| Back to top |
|
 |
Titan
Joined: 11 Aug 2004 Posts: 5009 Location: imaginationland
|
Posted: Sun Mar 19, 2006 1:41 am Post subject: |
|
|
| toralf wrote: | | test both and you'll see the difference. | I did and I noticed no difference  _________________
RegExReplace("irc.freenode.net/autohotkey", "^(?=(.(?=[\0-r\[]*((?<=\.).))))(?:[c-\x73]{2,8}(\S))+((2)|\b[^\2-]){2}\D++$", "$u3$1$3$4$2") |
|
| Back to top |
|
 |
|
|
You can post new topics in this forum You can reply to topics in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|