Customizing EditorScripts

April 23, 2009 No comment

Ax had a few interesting scripts for the developer. When you have an idea for a new useful script you can extend the the EditorScripts Class (ClassesEditorScripts) with your new class.

Here is a example where you automate some custom comment while developing:

1
2
3
4
5
6
7
void comments_MyComment(Editor e)
{
    e.unmark();
    e.gotoLine(1);
    e.gotoCol(1);
    e.insertLines(strfmt('//--> ProjectRef - By:%1 @ %2n', curuserid(), systemdateget()));
}

the result of this script is a new menu item in the comment editor scripts:
editorscript_mycomment
And when you click on it, you get the following comment on the first line of the method:

//--> ProjectRef - By:Admin @ 23/04/2009