blog for Dynamics Axapta

Posts tagged ‘Auto Comments’

Auto comments on our customization codes by Editor Script Class

Hi Friends,

Here I have posted the code for auto comments by amending Editor Scripts class.

Adding auto script CODE comments
// Changes: XYZ to your intial name
public void addCommentsCODE(Editor _e)
{
int startLine = _e.selectionStartLine();
int endLine = _e.selectionEndLine();
str prefixCompany = “CONTOSO”;
str developerID;
str tagStart;
str tagEnd;
;

switch (curUserId())
{
case “vasan”: developerID = “Vasanth”;
break;
case “steve”: developerID = “Steven”;
break;
default:
developerID = “XYZ”;
}

tagStart = strFmt(“//–> %1 modified on %2 %3 by %4: %5 ~ mod description\n”,
enum2str(currentAOLayer()),
date2str(today(), 321, 2, 3, 3, 3, 4), time2str(timeNow(), 1, 1),
prefixCompany,
developerID
);
tagEnd = strfmt(“//<– by %1\n”, prefixCompany);

_e.gotoCol(1);
_e.unmark();

_e.gotoLine(startLine);
_e.insertLines(tagStart);

_e.gotoLine(endLine+2);
_e.insertLines(tagEnd);
}

Once done, got to code window, right click -> scripts -> you find the method created. Hope it will help you.

// Vasanth Arivali

Advertisements