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:
ScreenShot of GUI; 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
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.