Create and Run an AutoFM Script

AutoFM scripts are simple XML files that can be created in FrameMaker or by other tools and processes.

AutoFM scripts must have a suffix of “autofm.xml”. You can provide additional text as a prefix. For example, mybook-autofm.xml. The following describes how to create an AutoFM script.

  1. Choose Pubs-Tools > AutoFM > New.

    You will be prompted for a file name, then a new AutoFM XML file is created.

  2. Add and modify elements and attributes to create the process needed.

    The Element Catalog shows the valid elements. Check the attributes for each element to see if there are any properties that should be set for elements you’ve added. Be sure to add the exit element to close FrameMaker after processing is complete.

  3. Always test a new script manually by choosing Pubs-Tools > AutoFM > Run command.

Once you’ve confirmed that everything is working as expected, proceed to automated testing using an external scripting environment. Set up a batch file or other command line scripting tool to run your AutoFM script.

Any scripting language that can run an executable should be able to drive your AutoFM script (DOS batch script, Perl, Ant, etc.). You just specify the FrameMaker executable and pass the AutoFM script to it as a command line parameter. It is typically best to specify the full path to both the FrameMaker executable and the AutoFM script, but this can change depending on your environment. Be sure to wrap paths in quotes if they contain spaces.

To run the AutoFM script just run the FrameMaker executable and pass the AutoFM filename as an argument, as in the following example:

"C:\Program Files (x86)\Adobe\AdobeFrameMaker12\FrameMaker.exe" "C:\Project\mybook-autofm.xml"

Another way to run the AutoFM script is to right-click the AutoFM file in Windows Explorer, and choose the Open With command then select FrameMaker.

If the AutoFM plugin is installed properly (both the DLL and the structure application), when FrameMaker starts and opens the AutoFM file, it begins processing the instructions in that file. The results of each step are saved to an <autofm-file>.log file. For additional debugging, the consfile.txt file (which contains the messages from the Console Window), is copied to a <autofm-file>_consfile.txt file in the same folder as the AutoFM file.

To generate a PDF you can use the saveas or print elements. At this time, in order to specify the various PDF properties you must use the print element and its related attributes. When printing a file to PDF, the default PDF Job Options file associated with the FM or BOOK file is used.

Tip: When using FM9 or later, it’s best to disable all pods as well as the Structure View window.