What is CodeHelper?


CodeHelper is a REAL basic program written by Barry Traver (with help from my friends) to help you analyze or modify RB Projects you have written or are writing (or, for that matter, other people have written).  At present it contains more than 100 tasks it can perform, many of which are difficult or near-impossible to do otherwise.


How does CodeHelper do this?


It does this by analyzing or modifying the RB Project by working with it as saved in XML format.


How much does CodeHelper cost?


CodeHelper is FREE in the sense that it does not cost any money.  If you like the program and find it helpful, I will not refuse a small financial gift, but such is NOT required; otherwise it would not be a gift <grin>.  If you use CodeHelper, however, you are expected to send some feedback (a couple sentences will do), such as what you like and/or don’t like, new features you would like to see added, other suggestions for improvement, bugs to re movet, etc.  So in that sense CodeHelper is NOT free.


What support is available for CodeHelper?


If you have questions or problems related to CodeHelper, you are invited to get in touch with me by e-mail (my e-mail address is or by phone (my home phone is 1-717-806-7166; I live in the Eastern time zone).  I will do my best to be of assistance.


What is included in a normal CodeHelper session?


There are four or five steps.


Step 1 is to go into the RB IDE, load in a RB Project (usually in .RBP format) that you want to work with, and save the Project in .XML format.


Step 2 (while still in the RB IDE) is to load in CodeHelper and run it.


Step 3 is (while running CodeHelper) is to load in the .XML file you created in the first step.  To do that, in CodeHelper on the very top menu bar choose File --> Open XML File.


At this point you can decide whichever of the tasks you wouldlike to have CodeHelper do.  ((The Main Menu is below top toolbar (“File Edit Help").


That menu is confusing.  How does it work?


Each line in the main menu is either a CATEGORY or a TASK.  The CATEGORIES are displayed as black text on a WHITE background.  Double-click on a category to expand it (that is, to show the tasks available in that category),  


The TASKS are displayed as black text on a YELLOW background.  Double-click on a task to perform it (an equivalent alternative is to single-click on the task and single-click on the "Perform the Task" button at the bottom of the window).


You can have CodeHelper perform a number of tasks, one after another, at this time.  After you finish a task, if you want to return to the Main Menu you can do so by clicking on the "Main Menu" tab near the top of the screen (an equivalent aternative is to single-click on the "Return to Main Menu" button at the bottom of the window).


On the Main Menu you can double-click on an expanded category to contract it (any tasks showing in that category will disappear) OR you can double-click on any unexpanded category to expand it (tasks in that category will appear and other tasks disappear from the menu).  Then you can double-click on a task to perform it and so on, until you've done all the tasks you want to do.


Are there different kinds of tasks?


Almost all of the tasks CodeHelper can perform fall into two categories:  tasks to ANALYZE your RB Project and tasks to MODIFY your RB Project.  Tasks that analyze our RB Project do not change your Project,  Only tasks that modify your Project DO change your Project, and that is done by changingthe .XML contents. 


Tasks that use .XML information ti ANALYZE your Project ordinarily perform that task and take you to the "Results" panel, where, for example, you are shown a list of requested items.  Tasks that MODIFY your Project after doing that usually take you to the "Source" panel, where you are shown the new source code, which is parsed from the modified .XML information (which you can access by looking at the "XML" panel).


It is important to understand that in CodeHelper Source code is dependent on XML, not the other way around.  Changing the XML will change the Project you're working on, but changing the Source will NOT change the Project.  For your protection, the default setting is that neither XML nor Source can be manually edited.  The option to make them editable is included in CodeHelper, but not recommended unless you are very sure of what you are doing.

All of this sounds more complicated than it is.  Usually, for Step 3 all you have to do is double-click on the tasks on the main menu that you want CodeHelper to perform.


What are the remaining steps in a normal session with CodeHelper?


The optional Step 4 is only relevant for those who have chosen tasks that modify your Project, tasks whose results you want to keep by saving the modified Project to disk.  On the very top menu bar ("File Edit Help") choose File --> Save XML FIle.  By the way, until you're really familiar with how to use CodeHelper, I recommend that you use a different filename than the original .XML file name (although you can always re-create the .XLM by repeating Step 1).


Step 5 (also optional) is to use File --> Exit on the top menu bar to exit CodeHelper.  If you chose to do the optional Step 4, you can load in and run the .XML file that was created in Step 4.  This time we use File --> Open on the RB IDE top menu.  At that point you may also want to save your modified Project in the more usual .RBP format.


Here are the categories and Tasks:


Newest Routines Added (1 - 5)

    1. Add Blank Line Footer

    2. Change Source to Editable

    3. Change Source to Read Only

    4. Change Font Throughout To Arial 24

    5. Change Font Throughout to System 0


Add Automatic Comments (6 - 8)

    6. Add Automatic "Next" Comments

    7. Add Automatic "Else" Comments

    8. Add Automatic "End If" Comments


Add Comment Symbols (9 - 11)

    9. Comment Out MsgBox Statements

   10. Comment Out Entire Source

   11. Comment Out Source And Add MsgBox


Add Headers Or Footers (12 - 13)

   12. Add Procedure Headers

   13. Add Procedure Footers


Alphabetize Methods (14 - 17)

   14. Alphabetize All Methods

   15. Alphabetize Event Handlers

   16. Alphabetize Menu Items

   17. Alphabetize User-Defined Methods


Change Character Spacing (18 - 25)

   18. Remove Unnecessary Spaces

   19. Add Extra Spaces Of All Types

   20. Put Spaces After Commas

   21. Put Spaces Around Parentheses Symbols

   22. Put Spaces Only Inside Parentheses Symbols

   23. Put Spaces Only Outside Parentheses Symbols

   24. Put Spaces Only Outside Outside Parentheses Symbols*"

   25. Put Spaces Around Symbols For Math Operators


Change End If/End and Next I/Next (26 - 29)

   26. Change End To End If

   27. Change End If To End

   28. Change Next to Next I

   29. Change Next I to Next


Change Line Spacing (30 - 34)

   30. Remove Blank Lines

   31. Separate Logical Units

   32. Double-Space Source Code

   33. Triple-Space Source Code

   34. Quadruple-Space Source Code


Conform in Case (35 - 44)

   35. Initial Conform

   36. Conform All (may take a while)

   37. Conform Constants

   38. Conform Controls

   39. Conform Line Labels

   40. Conform Methods

   41. Conform Modules

   42. Conform Properties

   43. Conform (most) REALbasic Keywords

   44. Conform Variables


Display Simple List of Names (45 - 46)

   45. Display Modules Used in Project

   46. Display REALbasic Keywords Used in Project


Display List of Names with Details (47 - 57)

   47. Display Constants Used in Project with Details

   48. Display Control Event Handlers Used in Project with Details

   49. Display Controls Used in Project With Details

   50. Display Functions Used in Project with Details

   51. Display General Event Handlers Used in Project with Details

   52. Display Line Labels Used in Project with Details

   53. Display Menu Items Used In Project with Details

   54. Display Methods Used in Project with Details

   55. Display Properties Used in Project with Details

   56. Display Subs Used in Project with Details

   57. Display Variables Used in Project with Details


Display List of Names by Location (58 - 68)

   58. Display Constants Used in Project by Location

   59. Display Control Event Handlers Used in Project by Location

   60. Display Controls Used in Project by Location

   61. Display Functions Used in Project by Location

   62. Display General Event Handlers Used in Project by Location

   63. Display Line Labels Used in Project by Location

   64. Display Menu Items Used In Project by Location

   65. Display Methods Used in Project by Location

   66. Display Properties Used in Project by Location

   67. Display Subs Used in Project by Location

   68. Display Variables Used in Project by Location


Display of Source Code with or without XML Line Numbers (69 - 72)

   69. Add XML Line Numbers To Source and XML

   70. Display Source Code For A Particular Method

   71, Display Source Code For Entire Project

   72. Remove XML Line Numbers From Source Code and XML;"


Increase Or Decrease Indentation (73 - 76)

  73. Remove Increased Indentation

  74. Increased Indent of 1

  75. Increased Indent of 2

  76. Increased Indent of 3


Locate Unnecessary Definitions (77 - 80)

  77. Check Variables And Properties For Duplicates

  78. Display Unused Methods

  79. Display Unused Properties

  80. Display Unused Variables


Obfuscate by Switching Names (81)

  81. Obfuscate Controls by Switching Names


Perform Miscellaneous Tasks (82 - 90)

  82. Change a Particular Name

  83. Combine Partial Source Lines

  84. Display Modifications Made by RB CodeHelper

  85. Display Project Information (long)

  86. Display Project Information (short)

  87. Edit the XML (use extreme caution!)

  88. Lock the XML

  89. Remove Source Line Breakpoints

  90. Undo Previous Change (if possible)


Prefix Method Names (91)

  91. Use "mnu" for Menu Items


Remove Automatic Comments (92 - 94)

  92. Remove Automatic "Next" Comments*"

  93. Remove Automatic "Else" Comments*"

  94. Remove Automatic "End If" Comments;"


Remove Other Comments (95 - 98)

  95. Remove All Comments (except ///)

  96. Remove // Comments (except ///)

  97. Remove ' Comments

  98. Remove Rem Comments


Remove Comment Symbols (99 - 100)

  99. Uncomment MsgBox Statements

  100. Uncomment Entire Source


Remove Headers Or Footers (101 - 102)

  101. Remove Procedure Headers

  102. Remove Procedure Footers


Unobfuscate by Switching Names (103)

  103. Unobfuscate Controls by Switching Names


  Finally (for now), here's a more detailed description ot some of the things that CodeHelper can do:


     1. Add automatic comment to End If line.

        Example:  End If // If Total > 200


     2. Add automatic comment to Else line.

        Example:  Else // If NOT (Total > 200)


     3. Add automatic comment to Next line.

        Example:  Next I // For I = 0 To LastLineNumber


     4. Add "boilerplate" material to beginning of procedures (e.g., header telling name of procedure, purpose, programmer, date, etc.).


     5. Add "boilerplate" material to end of procedures.



        MsgBox "An error occurred in Window1.EnableMenuItems."


     6. Check to see whether any Variables and any Properties have been given the same name.


     7. Check to see whether any Variables are DIMensioned but never actually used.


     8. Check to see whether any Properties in a procedure are defined but never actually used.


     9. Change font throughout to System for font and 0 for font size..


    10. Comment out all source code with indenting preserved (sometimes useful if a major rewrite of a program is needed).


    11. Comment out all MsgBox statements (sometimes useful if MsgBox is used only for debugging).


    12. Conform keywords to standard REALbasic format regarding case (e.g., "NEXT","next", "NExt" all become "Next").


    13. Display source code on screen for entire project or for a particular procedure.


    14. Display XML file on screen (including any modifications that have been made to the XML code).


    15. Edit XML or extracted Source or search for string or whole word in XML or extracted Source.


    16. Inset a space before and after mathematical operators ( + , - , , / , = , ^ , <> , >= , <= ), before or after parentheses symbols, and/or after commas.


    17. Increase indentation of source code beyond the normal indentation (sometimes makes source code more readable).


    18. Remove "//", " ' ", or "REM " symbols from source code.


    19. Remove all automatic "Else", "End If", or "Next" comments (see 1, 2, and 3 above).


    20. Remove all blank lines from source code.


    21. Remove procedure headers or footers (see 4 and 5 above).


    22. Remove highlighting from entire Project, setting the cursor at the top of each Method


    23. Restore indentation of source code to normal (see 17 above).


    24. Save to disk any of several lists (Constants, Controls, Line Labels, Menu Items, Methods, Modules, Passed Parameters, Properties),


    25. Save to disk extracted ur edited source code displayed on the screen.


    26. Save to disk (modified) XML file displayed on the screen (will run as a regular program).


    27. Send to printer any list, source code, or XML file on the screen (see 24, 25, and 26).


    28. Add appropriate counter variable to "Next" line (e.g., "Next" becomes "Next LineNumber").


    29. Double- or triple-space source code.


    30. Display list of modifications made to XML code by CodeHelper.


    31. Obfuscate (or unobfuscate) source code by switching control names.


    32. Change a "name" (variable name, property name, etc.) throughout the code (uses RegEx to change only "whole words").


    33. Display project information (short or long).


More information should be available in the near future on the preceding tasks plus information on additional tasks.


Barry Traver