Thursday, 27 October 2016

Comment all the code:

Comment all the code with Ctrl+E+C with shortcut (Or) Select your code right click and go to the
Scripts -> comments-> comment -> click on that you will get your code commented with the help of below code add this method in the EditorScripts class after that test it.

Public void comments_comment(Editor _editor)
{
    int startLine = _editor.selectionStartLine();
    int endLine   = _editor.selectionEndLine();
    int i;
    #define.comment('//')

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

Un-Comment all the code:

UnComment all the code with Ctrl+E+U with shortcut (Or) Select your code right click and go to the
Scripts -> comments-> uncomment -> click on that you will get your code commented with the help of below code add this method in the EditorScripts class after that test it.

public void comments_uncomment(Editor _editor)
{
    int startLine = _editor.selectionStartLine();
    int endLine   = _editor.selectionEndLine();
    int i, col;
    str line;
    #define.comment('//')

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

        line = _editor.currentLine();

        // Skip leading white space
        for (col = 1; col <= strlen(line); col++)
        {
            if (substr(line, col, 1) != ' ')
            {
                if (substr(line, col, strlen(#comment)) == #comment)
                {
                    _editor.gotoCol(col);
                    _editor.deleteChars(strlen(#comment));
                }
                break;
            }
        }
    }
}

 Insert Hader comments:

Add below method on the EditorScripts class: 

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

    e.insertLines('// Changed on ' + date2str(today(),123,2,1,3,1,4, DateFlags::FormatAll ) + ' at ' + time2str(timenow(), 11) + ' by ' + curuserid()'\n');

}
For Testing Go to the new jobs right click Scripts -> comments-> InsertHeader -> click on that you will get comment on your code header side.

Start comments:

Add below method on this class EditorScripts , and test in the job

public void comments_Started(Editor _editor)
{
    int startLine = _editor.selectionStartLine();
    int endLine   = _editor.selectionEndLine();
    int i;
   // #define.comment('//')

    _editor.unmark();
    for (i = startLine; i <= endLine; i++)
    {
        _editor.gotoLine(i);
        _editor.gotoCol(1);
        //_editor.insertString(#comment);
        _editor.insertLines('// Changes started on ' + date2str(today(),123,2,1,3,1,4, DateFlags::FormatAll ) + ' at ' + time2str(timenow(), 1, 1) + ' by ' + curuserid() +'\n');
    }
}

End comments:-

Add below method on this class EditorScripts , and test in the job

public void comments_END(Editor _editor)
{
    int startLine = _editor.selectionStartLine();
    int endLine   = _editor.selectionEndLine();
    int i;
   // #define.comment('//')

    _editor.unmark();
    for (i = startLine; i <= endLine; i++)
    {
        _editor.gotoLine(i);
        _editor.gotoCol(1);
        //_editor.insertString(#comment);
        _editor.insertLines('// Changes End on ' + date2str(today(),123,2,1,3,1,4, DateFlags::FormatAll ) + ' at ' + time2str(timenow(), 11) + ' by ' + curuserid() + '\n');
    }
}


http://stackoverflow.com/questions/27923749/how-to-fix-number-of-blank-rows-in-ssrs

https://sumitsaxfactor.wordpress.com/2012/07/14/create-project-tool-for-developers-ax-2012/


No comments:

Post a Comment