//NEW, Di, 10.07.2012: error handling for BOF and EOF

I have seen an problem when the paragraph was
at the beginning of the file, with no empty
line above it. And the same at the end of file
if there was no empty line following.

So my improved macro detect this and handles accordingly:

// language = "JavaScript"
// Select whole paragraph macro.
// An paragraph is an block of text delimited
// by two empty lines. (Or BOF/EOF)
// How to:
// 1. Have the cursor inside an paragraph.
// 2. execute this macro.
//NEW, Di, 10.07.2012: error handling for BOF and EOF

o = document.selection;
nFound = o.Find("^s*$",eeFindPrevious | eeFindReplaceRegExp);
if(nFound==0){o.StartOfDocument(); o.StartOfLine();
yPosBeg = o.GetActivePointY(eePosLogical);
yPosBeg = o.GetActivePointY(eePosLogical) +1;
nFound = o.Find("^s*?$",eeFindNext | eeFindReplaceRegExp);
if(nFound==0){o.EndOfDocument(); o.EndOfLine();
o.SetAnchorPoint(eePosLogical, 1, yPosBeg);
o.LineUp();o.EndOfLine(); //exclude trailing line break
o.SetAnchorPoint(eePosLogical, 1, yPosBeg);