Friday, November 4, 2011

Preventing Fireworks

A script that makes numerous changes to a document can create a flurry of screen activity that can be disturbing to a user. Successive cuts, copies, pastes, formatting changes, and the like can create "screen fireworks." Fortunately there is a way to save the user from viewing the changes as they happen: set the app property Displaying (session property in the FDK) to false.

You should also consider setting the app Reformatting property to false. This saves time as it tells FrameMaker not to reformat pages after each edit.

IMPORTANT: Don't forget to turn Displaying and Reformatting back to true when you are finished or you will leave the end user in the lurch!

When you are done, you need to explicitly reformat and then redisplay the document.

app.Displaying = false; //turn off screen redisplay
app.Reformatting = false; //turn off document reformatting

/*this does 100 pastes of the clipboard contents but any screen 
intensive operation could appear here */
for (var i=0; i <100; i++)
    doc.Paste(0); //paste the text
app.Displaying = true; //turn back on
app.Reformatting = true;

doc.Reformat();//update the formatting in the document you changed
doc.Redisplay();//redisplay the document

No comments:

Post a Comment