Write your own FrameMaker ExtendScript, Part 2

In January, long-time FrameMaker maven, Rick Quatro of Carmen Publishing, did a guest appearance in the second of a 2-part series on FrameMaker ExtendScripts. You may view the recording of “FrameMaker: How to write your own ExtendScripts, Part 2” here.

This session (Part 2) continues the process of creating a broadly useful ExtendScript for automating common tasks in FrameMaker, step-by-step. You can get a recording of the session here.

Variable for NewAnchoredFormattedVar (can copy the sample code and then fill-in the blanks)

12:45

editing var modDate so it will use “Modification Date (Long)” as the format

13:20

Specifying text location:

a paragraph

“0” to indicate beginning of the paragraph

15:00

Commenting out the first working task, so the 2nd task can be created and tested separately

15:44

Creating a temporary text frame and manually inserting a DATE system variable so format of date can be inserted into a marker

16:50

Locating NewTextFrame object. Noting that this can have a parent object (e.g. an Anchored Frame)

17:45

Pop-up menu of hints appears as you type in your definition for a method

19:40

Demonstration of the process for selecting an appropriate parent object

23:30

Using “constants” for values in javascript

26:30

Designating a text location within a temporary textframe. Goal: get the textframe and the variable within the textframe.

29:00

Locating the “delete” method to be used to delete a temporary textframe with DATE variable that is used to establish current time in specified format.

31:00

Function getSystemVariableValue (Goal is to have a generic “get system variable” that would work with any system variable. Variables are made of building blocks … and their order counts.

34:00

Getting the value from a system variable via script … demonstrating a successful text

35:00

After testing functions for VARIABLES, cluster them together towards the top of the script

38:00

Using an “alert” to have retrieved variable value DISPLAY in a pop-up menu

40:00

MetaModDate markers need to be deleted at end of process

44:00

Running test of the final script – marker has been inserted with current date in desired format (extracted from a SYSTEM VARIABLE) … and temporary TEXTFRAME has been deleted.

45:00

Running script a 2nd time, we get a 2nd marker with a new current time.

45:30

Now have desire to delete the previous markers if you need to update insertion of marker with current time in it.

46:00

What to do if there is no “current active” document

48:30

Testing the script when there is no active document. Code on line 13 of script will invoke a pop-up menu alerting you to need for an open/active document

49:30

Example of a minor failure because PGF object has not been created.

50:00

ANSWERING QUESTIONS

52:50

WHERE DO YOU SAVE PORTIONS OF SCRIPTS TO BE REUSED

Rick uses FileLocator Pro

57:00

FINAL SCRIPT DEMO … Rick creates a script that deals with the document that has multiple, redundant markers at the beginning of the first paragraph in the document. Specify the type of marker (name) to determine if it should be deleted … this creates a “loop” …

Get the full recordings of Part 1 and Part 2 of our webinars “FrameMaker: How to write your own ExtendScripts” here: