The key feature of this technique is that it allows you to use an easy undo to undo the change (Ctrl+Z) and preserves your place in the file after the operation.
The sample tool below runs the open source Astyle exe (C++ coder formatter) on the selected block, and is configured to implement whitesmith style c++ indentation (http://en.wikipedia.org/w...t_style#Whitesmiths_style), which i love.
MyAstyle MACRO
-------------------------
[copy or print]
InsertMode
ColumnModeOff
HexOff
UnixReOff
Copy
NewFile
Paste
SaveAs "C:\Temp\Astyle.tmp"
CloseFile
RunTool "MyAstyle"
Open "C:\Temp\Astyle.tmp"
SelectAll
Copy
CloseFile
ToggleBookmark
Paste
Open "C:\Temp\Astyle.tmp.orig"
SelectAll
Copy
CloseFile
PreviousBookmarkSelect
ToggleBookmark
InsertMode
ColumnModeOff
HexOff
UnixReOff
Copy
NewFile
Paste
SaveAs "C:\Temp\Astyle.tmp"
CloseFile
RunTool "MyAstyle"
Open "C:\Temp\Astyle.tmp"
SelectAll
Copy
CloseFile
ToggleBookmark
Paste
Open "C:\Temp\Astyle.tmp.orig"
SelectAll
Copy
CloseFile
PreviousBookmarkSelect
ToggleBookmark
MyAstyle TOOL Configuration:
-----------------------------
[copy or print]
COMMANDLINE -> D:\Libraries\astyle\astyle.exe --mode=c --indent-brackets --brackets=break --indent=tab --one-line=keep-blocks --one-line=keep-statements C:\Temp\Astyle.tmp
WORKINGDIRÂ -> C:\Temp\
MENUITEMNAME-> MyAstyle
DONT CHECK "CAPTURE OUTPUT" - this has the exe write output to a file.
COMMANDLINE -> D:\Libraries\astyle\astyle.exe --mode=c --indent-brackets --brackets=break --indent=tab --one-line=keep-blocks --one-line=keep-statements C:\Temp\Astyle.tmp
WORKINGDIRÂ -> C:\Temp\
MENUITEMNAME-> MyAstyle
DONT CHECK "CAPTURE OUTPUT" - this has the exe write output to a file.
if your exe outputs to stdout, then you should check "capture output" and modify the macro and remove the lines from the first Open to the subsequent Closefile.














Logged


