Sample Scripts/Utilities shipped with FrameMaker10

Thursday, March 17 2011 @ 7:54 AM, By Amit Agarwal

Hello Framers,

This blog is to share a few utilities written by the engineers of FM team. These scripts & utilities had been developed by engineering for internal use but on a later stage it was decided to ship it for the end-user with FrameMaker10. These are present in FrameMaker10 installation folder (a folder named $FMHOME\Samples\ScriptsAndU­tilities). These simple scripts/utilities (described briefly in the table below) could be used:

    - Either to get started with ExtendScript
    - Or as live examples for solving a workflow

 

 

List of Scripts/Utilities
Folder Name Type Brief Note
Hello World Extendscript Simplest script – Just to get started with Extend­script! More here
Conditional Text Extendscript Create several PDF outputs from a single-source based on the conditional text. NEEDS CUSTOM EDITING. (Attached modified .jsx file with modifications – FM_Outputs_CondText)

    - Specific Conditional Text is shown/hidden
    - PDF is generated
Flatten Conrefs Extendscript This script flattens all the conrefs present in all the topic refs of the Active Ditamap/Topic (ditamap needs to be open in document view)
Hierarchical Books ExtendScript Traverses through a hierarchical book structure.

    - An example to traverse the Folder and Group hierarchy.
    - Creates log of the traversal in a text file.
Read XML Extendscript An example to show how to read the elements’ content in an XML file.Exhibits node by node traversal.
Suppress Alerts Extendscript A useful script to suppress all alerts. This script uses notifications to suppress all FrameMaker alerts.
BookMIFWash API The client opens all components of the book-in-focus and washes them via MIF:

    - Save them as MIFs
    - Save the MIFs back to .FM

 

We had added usage instructions in the Scripts/Clients (but you know how internal use code is : ). We hope these would be helpful!

Download Zip File: ScriptsAndUtilities

COMMENTS

  • By Elena C - 3:00 PM on March 29, 2011  

    Hi,
    I’m new to ExtendScript, but I tried the “Conditional Text” script, which generated two PDFs out of an FM10 book with two conditions. Unfortunately, I think the script is missing a function to update the book, after show/hiding each condition, which leads to generating the PDFs with empty pages and false numbering.
    I could not find a list of FrameMaker functions, nor could I find an update function in other scripts. Could you please tell us what to add to the “Conditional Text” script, to make sure the open book is updated, before generating each PDF? It would also be great to know the function for hiding the condition indicators.
    Thanks a lot for sharing the scripts.

  • By Amit Agarwal - 6:41 AM on March 30, 2011  

    Hi Elena,

    There are 2 scripts in the Conditional Text folder:
    1. FM_Outputs_CondText.jsx
    2. FM_Outputs_CondText_XML.jsx

    Both of them do the same task of producing PDF based on the specified conditional tags.

    In Script1, one can specify the tags to Show/Hide WITHIN the script.
    whereas in Script2, the specification of tags has been moved to an XML file (data.xml)

    Script1:
    Each output to be generated has its show/hide tag list that needs to be defined in these statements (one may add more too):

    ShowList[0] = new Array(“Comment”, “Red”);
    HideList[0] = new Array(“Blue”, “Green”);

    And the output names here (one may add more outputs separated by comma):

    var OutPutFiles = new Array(“_Comment_Red.pdf”, “_Blue_Green.pdf”);

    Script2:
    Has 2 tags for each PDF to be produced. Each output tag can have its & tag list (one may add more tags too)

    And regarding the update book function try using:

    FileSource.SimpleGenerate(0,1);

    before the SavePDF function.

    For Show/Hide I have used: CondFmtId.CondFmtIsShown = 1 or 0

    Let me know if you have more queries. Infact, I would add these to the main blog later to make it more informative.

    • By Elena C - 4:23 PM on March 30, 2011  

      Hi Amit,

      many thanks for the answers!

      I’m using FM_Outputs_CondText.jsx for now.
      What I also needed to adjust, were the destination folder and the names of the generated files. So I added something like this:
      OutputPath=”C:\\output\\folder\\”
      Changed the line about the names:
      var OutPutFiles = new Array(“first_conditioned.pdf”, “second_conditioned.pdf”);
      And finally changed the arguments of the SavePdf function:
      SavePdf(FileSource,OutputPath + OutPutFiles[output_no]);
      Now I don’t need to move or rename the generated files. They are saved directly where I need them.

      The update function works fine. (I have a problem which might be off topic here: how do I set a condition to an entire file in a book? I applied the condition to the content of the file, but when I generate the PDF with the hidden condition, the chapters are not numbered correctly. The “hidden” chapter number is just missing. For the moment I’m using a second book, containing the same files, except that one… but it’s not that efficient, is it?)

      Regarding the other function: CondFmtId.CondFmtIsShown = 1 or 0 activates or deactivates the condition itself. Or at least that’s what I noticed, switching between 1 and 0.
      I need your help with finding the function for hiding the condition indicators, meaning the color (red, green…) or whatever formatting the writer would use, to mark the conditional texts. Right now, my generated PDFs contain red or green text.

      Thanks again for your time!

      • By Amit Agarwal - 5:29 AM on March 31, 2011  

        Great! you made the script work for you!

        One may use the command below to hide the color indicators in the OpenBookFiles() function: (attaching the modified script in main blog)
        fileId.ShowCondIndicators = 0;

        Regarding the chapter numbers not being numbered properly, it should have been solved by the SimpleGenerate() function. If you still facing the issue do send me small set of your files at amagarwa at adobe dot com

  • By Ian Saunders - 2:29 PM on May 4, 2011  

    Hi,

    I have just installed Frame 10. My BookMIFWash folder does not contain the corresponding script. There are scripts in all the other script folders. How can I get a copy of this script?

    • By Amit Agarwal - 11:25 AM on May 5, 2011  

      Hi Ian,

      The BookMIFWash folder doesn’t contain the extendscript but the API client (FDK client). Also the folder has its client compiled as a .dll that is ready to use (just add an entry in maker.ini).

      Regards,
      Amit

  • By Brian E. - 1:30 PM on June 7, 2011  

    Hi,
    I’m having a problem where when I run FM_Outputs_CondText.jsx from within the ExtendScript editor I always get the error: “GetOpenDefaultParams is not a function” on the first line within the OpenBook() function. Yet when I run the same script from within FrameMaker it runs just fine. Is there something I need to do to get the ExtendScript Toolkit to recognize this is a valid function for a FrameMaker script?
    Thanks,
    Brian

    • By Brian E. - 2:09 PM on June 7, 2011  

      Aha. Hadn’t selected the target application in the dropdown. Is there a way to get it to remember that so I don’t have to change it every time I open ExtendScript?

      • By Rick Quatro - 3:11 PM on July 15, 2011  

        Put this as the first line of your script:

        #target FrameMaker

  • By Dave - 12:51 AM on April 13, 2012  

    Would it be too much to ask for you lot to post a link to download the files you are talking about?

    • By amagarwa - 5:18 AM on May 29, 2013  

      The blog has been updated with a downloadable zip file.

  • By Serge Menard - 7:51 PM on July 26, 2012  

    Hi, I used the BookMIFWash utility to convert to FM 10 and it worked A1 at the book level. Unfortunately it doesn’t wash the referenced insets found in the FM files in the book. Is there a way to do that using BookMIFWash or another script or utility. Thanks 

    • By amagarwa - 5:28 AM on May 29, 2013  

      As of now, this utility doesn’t wash the insets.

      You may try making insets part of the book (temporarily), the insets might get mif-washed in the process.

  • By Kevin MacDowell - 11:02 PM on October 23, 2012  

    Amit, thanks for the scripts! What do you mean by “wash” ? BTW you have the same name as someone I worked for in San Diego, CA and Bangalore.

    • By amagarwa - 5:28 AM on May 29, 2013  

      Thanks Kevin! Amit is the most common name here in the region I live in India. :)

      The “wash” here means cleaning the FM files of the inconsistencies that might have creeped in, during complex operations, if any. MIF wash has been seen to correct the FM files of its errors.

  • By Matthias Nietert - 3:24 PM on March 20, 2014  

    Is there a version from BookMIFWash for Framemaker 11 available?

    Actually I need script to convert automatically all fm files in a folder into mif files. We have to translate often FM11 files and the transaltion software only works with mif files. So I have to open each fm files and save them afterwards as mif 11 file.

  • Categories

  • Archives

  • Authors

  • Useful Links

  • Recent Comments

    • Don Bridges: I expect privacy concerns will tamper IoT for our homes and consumers, but for business it will usher a...
    • Lois Patterson: I’m always happy to see math support, although I’m not currently using FrameMaker. I have...
    • Olga: I know it’s a really old post but I was unable to find any information online. I need to number the...
    • click: yes. http://wwwimages.adobe.com/www .adobe.com/content/dam/Adobe/e n/volume-licensing/pdfs/avl...
    • tiggyboo: I know the specs say IE 9 or greater is required – but was Server 12 developed specifically for IE or...