FrameScript for Newbies

Excerpted from my book FrameScript for Newbies Copyright [7/17/2007] by Paul Schnall

In general FrameScript is used to perform complicated tasks on large books or on whole document sets. Scripts can also be written to perform tasks on the document level, these range from manipulating paragraphs to tables. Large complicated scripts are usually written by professional scriptwriters, but with a little help any technical writer can acquire the skills needed to start writing scripts quickly and easily.

FrameScript is an object oriented scripting language. Everything in FrameMaker is either an object or an object property. In FrameMaker object properties are characteristics of the objects, for example, text can have a property that the font color is green. FrameMaker objects can be all encompassing to include all of the books and documents open in a session (a session is anything that occurs after you start FrameMaker until you close FrameMaker) down to the color of a font or the background color in a table cell. In general each object and its corresponding properties can be accessed and manipulated, except for read only properties. By accessing and manipulating these objects and properties it is possible to change:
  • text
  • markers
  • font sizes
  • colors

Also almost any property of a:

  • document
  • paragraph
  • table
  • character

The figure below shows part of the object hierarchy of FrameMaker.

Figure 1. Sample of the FrameMaker Hierarchy.

Variables

Variables are names given to objects or properties, like names for the children in a class. Variables are arbitrary names the writer chooses. I usually precede them with the letter v to make them stand out in the script.

For example:

You want to run a script that searches each paragraph for a specific word. You can assign a variable (I use the name vPgf) to the first paragraph in the document or the first paragraph in the main flow of the document.

Set VPgf = vCurrentDoc.MainFlowInDoc.FirstPgfInFlow;

Once the variable is assigned to the first object in the flow or document, if the property “Next ---- in doc ” or “Next----in Flow” exists in the Reference guide, then you can just keep reassigning the variable the to the next whatever in the doc until you reach the end.

Set VPgf = VPgf.NextPgfInFlow;

Objects other than paragraphs also have an associated Next command. For example tables, markers, and graphics, also have this command.

Set Command

The set command assigns a variable to an object or an object property.

1) Set vCurrentDoc = ActiveDoc;

This command assigns the variable vCurrentDoc to the object ActiveDoc. ActiveDoc is the open document in the FrameMaker window (this is an object). With the Variable vCurrentDoc set to the ActiveDoc, I can now specify objects deeper in the hierarchy (from the document to a paragraph to the paragraph format to the font color) using this variable. See ‎Figure 1 for the hierarchy from document to paragraph format.

2) Set VPgf = vCurrentDoc.MainFlowInDoc.FirstPgfInFlow;

Since the vCurrentDoc has already been specified, I can now drill down through the hierarchy, through the main flow in the document, to the first paragraph in the flow.

These two lines at the beginning of a script tell FrameScript to run the script on the currently active document and it sets the script to start at the first paragraph of the main flow in the document.

Note: Starting with the first paragraph in a document and proceeding to the NextPgfInDoc does not go through the document paragraph by paragraph in the order in which the paragraphs are written, whereas MainFlowInDoc.NextPgfInFlow does.

Note: There are all sorts of tables and text related to reference pages and master pages preceding the actual document, and your scripts can run through these first if you use the First---in Doc command.
 

Useful Information

  • Job Listings (visible to only members)

  • Employee Benefits

  • Other Sites and Resources

    Survey Reporting

    Q2 2010 Survey Results

    Requires access rights

    Employee Salaries (18 pp)

    Freelance Writer Rates (11 pp)

    Q4/09 Copy Editor Rates (9 pp)


    Columns on Elephant

    Translatable but Debatable

    Each month, Mark L. Levinson presents one hard-to-translate Hebrew word at a time for discussion.

    Of Mice and Keyboard Shortcuts

    Michael Cohen will teach us practical shortcuts that save us time and make our lives easier.

    The Why of Style

    Mark L. Levinson examines the big and little factors that make writing effective.

    Broken Bell Education in Israel

    David Siegel looks at the problems in education in Israel and discusses what can be done.

    Jonathan's Tool Bar & Grill

    Jonathan Plutchok identifies free or inexpensive utilities or plug-ins that save time, increase productivity, improve your computing environment, perform a task you otherwise couldn't do... or is just too much fun to ignore. This column has grown into its own blog at http://jonathanstoolbar.blogspot.com where you can find new issues every week.

    It's in The Script

    Paul Schnall teaches us about the power of FrameScript and how to use it.

    Do it Yourself

    Did you ever wonder what was inside a PC, laptop, or other microcomputer system? Michael Cohen teaches us what's inside and how to configure and build our own.

    Coaching for Success

    Dr. Tal discusses the principles of professional coaching, focusing on resiliency.

    Hunters and Gatherers

    Eric Gluch looks at modern marketing.

    Moving to Chelm

    Esther Shira Stepansky takes us on a humorous adventure in the modern day land of Chelm as we look at some of the challenges of making aliyah and finding work in Israel. Making aliyah is supposed to be the fulfillment of my of your Jewish identity, so why does Israel make it so difficult?

    Why am I a Tech Writer?

    By Michael Altman

    Life as a Tech Writer

    By Mumpy

    Building Bridges (in Hebrew)

    Dr. Zaidel discusses another aspect of mediation within the framework of Israel's court-approved Alternative Dispute Resolution (ADR) process.

    Don't Forget

    Hezy Asher teaches us how to improve our memory.

    World of Podcasting

    Tom Johnson's podcast episodes, provide tips on recording presentations, and other podcasting related news and events.

    Effective Management ניהול אפקטיבי

    By Eitan Reuveni

    Scribblin' With Steph

    By Stephanie Freid

    Life in Northern Israel

    By multiple authors

    Life on the Southern Front of Israel

    By Israel Ivri

    Event Summaries

    Summaries of events held by Elephant and other organizations throughout the Israeli technical/marcom community.