July 30, 2014 at 10:55 am #18708
Stefan
Participant
Oh, you was faster than I?
I have just this moment worked on this too :
//JavaScript Macro for EmEditor, v0.01 by Stefan
//Purpose: Ensure that last line is a blank one, by adding one if need.
//EmEditor Help - EmEditor Macro Reference - Document Object
//Retrieves the number of the lines in the document:
nLines = document.GetLines();
//Retrieves the text on the specified line:
str = document.GetLine(nLines);
if(str.length != 0){
//If last line is NOT empty, add one blank line:
document.selection.EndOfDocument();
document.selection.NewLine();
//Workaround: Delete automatically added indenting from line above,//
//if line was not empty but indented by white space//
//Selects a line at the cursor:
document.selection.SelectLine();
//Deletes the selected text:
document.selection.Delete();
}