ExtendScript of the Week: Find/Change Cross Reference Formats / Conditional Tags / Variables
This week in “Extend Script of the Week” initiative we will showcase an extend script which will Find/Change Cross-Reference Formats (aka “XREF Formats), Conditional Tags and Variables on the Body page of a FrameMaker document. This script demonstrates how to use ExtendScript to traverse a document, find Xrefs/Conditional Tags/Variables and then change them or delete them.
Information about the Scripts
- The zip contains seven ExtendScripts:
- ChangeFormatMenu.jsx loads the menu and calls the function to execute the work flow.
- ChangeConditionalFormat.jsx is used to change the conditional tag.
- ChangeVariable.jsx is used to change the variable.
- ChangeXrefFormat.jsx is used to change the format of the XRef.
- ChangeFormatUtils.jsx contains various utilty functions.
- ChangeFormatUI.jsx prepares the UI to be launched in FM.
- BookIterator.jsx is used to iterate over the book.
- The script works on FM/MIF, nested books and its components as well as on the hierarchical components.
- Any XML file, dita or map which is a part of the book is left untouched.
- The script will pick up the format/variable/tag from the document or the first non generated component of book.
- If run on a book, all unopened components will be opened silently and will be modified, saved and closed without asking. All opened components will be modified and left visible.
- User has an option to include System Variables, by default it has been excluded as it makes the list quite long.
- User also has an option to delete the conditional tag/variable/xref format which was replaced after the changes are made.
- At the end the user will be notified about the number of changes made in the document.
Steps to Install
- Download the zip file from ChangeFormat.
- Unzip the files and copy “ChangeFormatMenu.jsx” and “ChangeFormat” folder in startup folder located at “C:\Program Files\Adobe\AdobeFrameMaker10\startup\”
How to use the Script
- Launch FrameMaker
- Open a Book File or FM/MIF File eg : Doc1_10.fm
- Run Change Formats from “File -> Utilities -> Change Formats…“
- This will run the script and ask you for inputs for find/change.
- Click on the radio button to choose the object you want to change.
- Choose the value to be changed in ‘Find’ dropdown.
- Choose the value to be applied in ‘Replace With’ dropdown.
- Click on Change button.
I hope this will prove useful to many folks and you can add extra functionality as per your requirements to these scripts to make it even more powerful
(Resources: ChangeFormats)