[Date Prev][Date Next] [Thread Prev][Thread Next]
[Date Index] [Thread Index] [New search]

Happy Thanksgiving

Dear Framers and Scripters,

I am thankful to be part of a great online community. Thanks to all of you
for making this a great year.

Here is a small FrameScript script that deletes empty paragraphs in a
document. This script avoids two problems that can occur when doing this
with stock FrameMaker:

1) Finding \p\p and Changing to \p temporarily merges two paragraphs,
causing the second paragraph to become tagged with the first paragraph's

2) Paragraphs without text are not always empty; they may contain markers,
tables, or anchored frames. This script only deletes EMPTY paragraphs.

Rick Quatro and Family

// Test for an active document.
If ActiveDoc = 0
  MsgBox 'No active document.    ' Mode(Note);
  LeaveSub; // Exit the script.
  Set vCurrentDoc = ActiveDoc;

// Turn off document display to speed the script and
// prevent screen flicker.
Set Displaying = 0;

// Test ALL paragraphs in the document. Find out the
// offset of the end of the paragraph. If the offset is
// zero, then the paragraph is truly empty. A paragraph
// that contains a marker, table anchor, etc. may appear
// empty, but its PgfEnd offset will not be zero, and
// therefore, will not be deleted.
Set vPgf = vCurrentDoc.FirstPgfInDoc;
Loop While(vPgf)
  Get TextList InObject(vPgf) NewVar(vPgfEnd) PgfEnd;
  Get Member Number(1) From(vPgfEnd) NewVar(vPgfEnd);
  If vPgfEnd.TextOffset = 0
    Set vDelete = vPgf;
    Set vPgf = vPgf.NextPgfInDoc;
    Delete Object(vDelete);
    Set vPgf = vPgf.NextPgfInDoc;

// Turn on document display and refresh the screen.
Set Displaying = 1;
Execute Fc KbdRefreshWin;

** To unsubscribe, send a message to majordomo@omsys.com **
** with "unsubscribe framers" (no quotes) in the body.   **