June 20, 2012

Comments in Code Editor - EditorScripts class

Comments in Code Editor (Edit  EditorScripts class)

Hi Friends,

try the following code to add your own function in Code editor.
Class Name:- EditorScripts
Method 1- To Insert Header and Footer
Add a new method and copy and paste following code, 

public void theaxapta_insert_HeaderFooter(Editor e)
{
    e.unmark();
  //  e.gotoLine(1);
   // e.gotoCol(1);

    e.insertLines('// Added or Modified on ' + date2str(today(),123,2,1,3,1,4, DateFlags::FormatAll ) + ' at ' + time2str(timenow(), 1, 1) + ' by theaxapta(' + curuserid() +') Begin:' + '\n');
    e.insertLines('// Added or Modified on ' + date2str(today(),123,2,1,3,1,4, DateFlags::FormatAll ) + ' at ' + time2str(timenow(), 1, 1) + ' by WCL(' + curuserid() +') End:' + '\n');
}

Method 2- Insert Comment

public void theaxapta_comment(Editor _editor)
{
    int startLine = _editor.selectionStartLine();
    int endLine   = _editor.selectionEndLine();
    int i;
    #define.comment('// added or modified by WCL')

    _editor.unmark();
    for (i = startLine; i <= endLine; i++)
    {
        _editor.gotoLine(i);
        _editor.gotoCol(1);
        _editor.insertString(#comment);
    }
}

Above code will available in code editor -> when u open a code editor  -> right click-> scripts-> here u find 

1. Theaxapta - Insert Header
2. Theaxapta - Comment

 Make some changes as per your requirement.
Enjoyyyyyyyyy

-Harry

1 comment:

  1. Intolerance is the most socially acceptable form of egotism, for it permits us to assume superiority without personal boasting. See the link below for more info.


    #assume
    www.ufgop.org


    ReplyDelete

Thanks

Note: Only a member of this blog may post a comment.