ExtendScript of the Week: Change Styles (Paragraph / Character / Table)
This week in “ExtendScript of the Week” initiative we will showcase an ExtendScript which will Find/Change Paragraph Styles, Character Styles and Table Styles on the body page of the document. This script demonstrates one of the several workflows where ExtendScript can be used to do tasks in an intuitive and easy way. The script works on Book as well as single FrameMaker / MIF files.
Info
Please note that there is a newer version of this script with much improved functionality here.
About this Script
- On running the script this dialog appears:
- The dialog contains three radio buttons – namely “Para Style”, “Char Style” and “Table Style” and two buttons “Change” and “Cancel”.
- You can choose the style type to be changed by clicking on the appropriate radio button and the FIND and CHANGE dropdowns are populated by the styles existing in the active document or if run on a book the styles are taken from the first non generated file in the book.
- E.g., if you run the script on the attached Sample_Book.book/Doc1.fm then choose “Para Style” radio button.
- Now choose
NewParaFormat-Blue
in the FIND dropdown. - Choose
NewParaFormat-Red
in the CHANGE dropdown. - Click on Change button.
- Now the script will iterate through all paragraphs of all components of the book and wherever the paragraph format is
NewParaFormat-Blue
, it is changed toNewParaFormat-Red
. - Similarly you can change character formats and table formats in a book or document.
- After changing the style, an alert will appear informing the user about the number of changes that were done in the operation.
Steps to Install
- Download the zip file from ChangeStyles
- Unzip the files and copy “ChangeStyleMenu.jsx” and “ChangeStyle” 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
- Run Change Styles from “File -> Utilities -> Change Styles …“
- This will run the script and ask you for inputs to change the style.
- Choose the style to be changed in ‘Find’ dropdown.
- Choose the style to be applied in ‘Change’ dropdown.
- Click on Change button.
- If the script is run on an open FM/MIF file the styles will be changed without saving the document.
- If the script is run on a Book, all the FM/MIF components which are closed are opened invisibly, the styles are changed and then the files are closed after saving.
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.
Regards,
Bharat Prakash
(Resources: ChangeStyles)