'Hello World': Inserting New Text

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

Today we will add text to the document, and then we will add a paragraph to a document.

Inserting Text

To insert text use the New Text command. But first:

  1. Open a document.
  2. Place the cursor in the document at the location that you want to add the text.

Open the FrameScript editor and type in the command:

New Text 'Hello World';

This command inserts the text that is within the single quotes, at the cursor location.

You can specify a location to place the text (thus bypassing the cursor location) using the TextLoc argument. The command looks like this:

New Text 'Hello World' TextLoc(vTextLoc);

The TexLoc argument is explained in my book Framescript for Newbies.

Inserting New Paragraphs

To write a new paragraph into a document use the New Pgf command. But first

  1. Open a document.

Open the FrameScript editor and type in the command:

New Pgf NewVar(vNewPgf) PgfFmtName('Body') Text('Hello World');

The NewPgf command has the following arguments (parameters that can be specified in the command).

NewVar assigns the variable name in the parenthesis to the new paragraph.

PgfFmtName assigns the paragraph format that is named within the single quotes to the new paragraph.

Text places the text that is found within the single quotes into the new paragraph.

Note! The paragraph format name must already exist in the catalog, or the script may react unpredictably.

This code will place the new paragraph at the first paragraph in the document and move all of the rest of the paragraphs in the document down one paragraph. It will have the paragraph format of the style ‘Body’. It will have a variable name of vNewPgf.

Note:

All new paragraphs are placed as the first Pgf in the doc if their location is not specified in the command.

The new paragraph can be placed anywhere in the document by using the PrevObject argument. By specifying an object and giving it a variable name you can specify the location of the new Paragraph by adding the PrevObject argument.

The three lines of code below start out specifying the variable vCurrentDoc and assigning it to the active document in the FrameMaker session. The second line of code specifies the variable vPgf and assigns it to the first paragraph in the main flow in the document. Because vPgf is defined in the script I can use it to specify the place to put the new paragraph. The new paragraph will be placed immediately after vPgf.

1) Set vCurrentDoc = ActiveDoc;

2) Set vPgf = vCurrentDoc.MainFlowInDoc.FirstPgfInFlow;

3) New Pgf  NewVar(vNewPgf) PrevObject(vPgf) PgfFmtName('Body') Text('Hello World');

The Text of the paragraph ('Hello World') can also be a variable.

Set vCurrentDoc = ActiveDoc;

Set vPgf = vCurrentDoc.MainFlowInDoc.FirstPgfInFlow;

New Pgf NewVar(vNewPgf) PrevObject(vPgf) PgfFmtName('Comment') Text(vPgf.Text);

Note: When using a variable to specify text the variable name is not put in quotes.

 

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.