Designed to Help You Run Your Business More Efficiently.     
Home  |  About AIMS  |  Contact Us  

  • Clients

  • FAQs

  • Programs

  • Tips

  • Fees

Script Formatter
(Last update: 2012-07-08)

Download Installation File - for A5v5 and up
The one install file installs to all applicable versions of A5 that are installed on your computer.
Updated April 22, 2015 - Version #141

What does the AIMS Script Formatter do?

The AIMS Script Formatter standardizes the capitalization, indents, and spaces within your xbasic code for maximum readability and searchability. It allows you to adjust the settings to meet your own personal preferences and remembers your last settings as the default. It can also add "highlighting" to labels within your scripts so they are easier to find and "indent markers" around long IF, FOR, WHILE, etc. sections to indicate how many lines are in that section so you can easily skip past it if you want to.



(I hate to have to say this but it also avoids the issue that Alpha's built-in formatter has with nested SELECT statements. If you have nested SELECT statements, Alpha's formatter messes them up and the indents will need to be corrected manually to make them more readable again. Also, Alpha's formatter will not format anything in the %code% section of an xdialog.)

If you find this useful, feel free to
to encourage more utilities like this in the future.
At least e-mail me so I can let you know about future updates.

Features:

  • New Feature in version 131 you can now select the minimum number of lines required before 'marker' lines are added.
  • New Feature in version 130 that can be used to add 'marker' lines around long IF, FOR, WHILE, and SELECT statements to make it easier to quickly and positively identify their start and end lines.
  • New Feature in version 128 that locates active Debug(1) calls and 'developer' message boxes.
  • New Feature in version 126 that wraps comment lines for consistency and easier reading in the Code Editor and when printed.
  • New Feature in version 124 that checks for variables that exist in DIM statements but aren't used anywhere else.
  • New Feature in version 119 that is a sort of combination Hint/Update: Use background colors in the xdialog 'code' section and still allow the formatter to re-format that code as necessary.
  • Any option can be set to "no change" by un-checking all related option choices.
  • Optionally capitalizes all command names for improved readability. Capitalization can be set to UPPER, lower, or First Letter Upper. (Command names include: DIM, OPTIONS, DECLARE, FOR...NEXT, GOTO, IF...THEN, etc.)
  • Optionally sets indent levels for loops. The indent level for ELSE and CASE lines can be set to a full tab or to a 'partial' indent to conserve horizontal space. The indent level for CASE lines can even be set to 'none' - this lines up the CASE with the SELECT statement but still indents the lines within each CASE statement.
  • Adds a single quote at the end of any simple "END" statement. This allows you to search for END' so you won't find spend a lot of time wading through things like END IF, Send, Recommendation, {endregion}, etc.
  • Optionally adds or removes spaces around 'comparison' characters. => =,<,>,<>,<=,>=
  • Optionally adds or removes spaces around logical comparisons. => .and., .or., .not.
  • Optionally adds or removes spaces around math characters. => +,-,/,*
  • Optionally adds or removes spaces at the beginning and end of parenthesis. ==> ui_msg_box("Title",msg,ui_yes_no) or ui_msg_box( "Title",msg,ui_yes_no )
  • Optionally adds or removes spaces after commas. ==> ui_msg_box( "Title",msg,ui_yes_no ) or ui_msg_box( "Title", msg, ui_yes_no )
  • Optionally adds dashed lines above and below labels to make them easier to find:
    '--------------
    MyLabel:
    '--------------
  • Optionally adds "indent markers" around long IF, WHILE, SELECT, etc. statements.
    '----- A >----- 152
    [152 lines of code here]
    '----- A <----- 152
  • Will NOT change anything inside crlf() lists (%xxxx%). This includes xdialog box definitions as well as any other crlf() lists. One exception - any list named %code% or %code_section% will be treated like any other code except that the indents will be started over at 0 (the left border) for everything within the %code% section.
    (Version 119 update: The formatter can be used to switch all %code% sections to %code_section% and back. See version 119 details for more info.)
Running AIMS Script Formatter addin:

  • A5 must be restarted after installing the addin.
  • When actually editing xbasic code, go to the menu bar and click Code/Addins to start the Script Formatter addin.
  • When in the Code tab of the Control Panel, either select Code from the menu or right click in the white area and click Addins at the bottom of the drop-down list.
  • The rest should be self-explanatory.
What files will be installed?

  • AIMS_Script_Formatter.aex will be installed in the Addins_installed folder under the folder where your A5v5, v6, and/or v7 program was installed. This is the file that actually contains the code.
  • AIMS_Script_Formatter.code_editor and AIMS_Script_Formatter.new_code will be installed in the Control_Panel_Addins folder(s). These files add icons to the "Addins" selection when you right click in the blank area of the Code tab or on the Code Editor menu (Code/Addins) when you are actually editing code.

Version Updates:

Version 141: 2015-04-22
  • Fixed a problem with indent markers when the first word of a line in a %list% section was IF, WHILE, etc.
Version 140: 2015-03-03
  • Improved the routine for getting 'variable' names based on function arguments. See update #138. It now correctly retrieves the names even if (1) the " as " part is missing or (2) the argument has an "=" part to define a default value.
Version 139: 2015-02-03
  • The starting indent marker now includes the number of lines in the indent. (Previously only the last marker showed the number of lines.)
Version 138: 2014-09-14
  • Fixed error in AIMS_Verify_Dim_Used() function when getting 'variable' names based on function arguments.
Version 137: 2014-07-17
  • Minor changes for A5v5 compatibility.
  • Added ability to set code editor colors. (See help button to the right of the Convert %Code% button.
Version 136: 2014-05-28
  • Improved the 'Verify DIM Used' function. It now looks at function arguments as a DIMed variable.
Version 135: 2014-05-11
  • Fixed problem when text to be wrapped is longer than 1024 characters.
Version 134: 2014-01-26
  • Internal testing only.
Version 133: 2013-11-13
  • Now correctly correctly skips %dlg% and other %<list>% sections. (Except for %code% sections.) In some cases there can be lines in these lists that start with FOR, IF, WHILE, SELECT, NEXT, etc. and they were causing problems in earlier versions.
Version 132: 2013-11-03
  • The new "indent markers" routine now correctly removes old markers whenever reformatting and adding new markers.
  • Modified the "%code%" conversion routines to run faster and work in a more developer friendly manner.
  • A few other minor tweaks and improvements.
Version 131:
  • You can now select the minimum number of lines required before 'indent marker' lines are added.
Version 130:
  • Option to add 'indent marker' lines around long IF, FOR, WHILE, and SELECT statements to make it easier to quickly find their start and end lines.
Version 128:
  • New feature that locates active Debug(1) calls and 'developer' message boxes; i.e., message boxes that start with "*" in the title. This was done to help clean up a program before giving it to the customer.
       Developer message box example: ui_msg_box( "*<optional title>", "Some developer message." )
Version 130:
  • Option to wrap comment lines for consistency and easier reading in the Code Editor and when printed.
Version 124: 2011-08-01
  • Added routine to check for DIMed variables that aren't used.
  • Fixed a problem that caused lines beginning with special characters to lose that special character. This was mostly an issue when using "\" as a line continuation character.
  • Fixed a problem with adding spaces in parentheses. If it's only a number such as crlf(2), adding extra spaces seems like too much. It was returning "crlf( 2)" whenever there was more than one "(" in the line.
Version 122: 2006-01-01Jan-06
  • Fixed an another error recently introduced (v121?) that caused the routine to indent the %code% section at the same level as the surrounding code. This would sometimes cause an error message when running the code if the ending %code% line was indented.
Version 121: 2005-12-21
  • Fixed an error introduce in version 119 that caused the routine to lose track of the original indent level after the %code% section of an xdialog ended. (Indenting continued but at the wrong base indent level.)
Version 120: 2005-12-15
  • Fixed an error introduce in version 119 that caused the routine to crash.

AIMS DataCom, Inc. - Custom Database Applications
This site created and maintained by Cal Locklin, CALocklin@chartermi.net, using 1st Page 2000.   Last update:  23-Feb-07
This site may be freely linked to but not duplicated in any fashion without prior written consent.