ExtendScript of the week: Externalizing Graphics

Monday, December 19 2011 @ 2:00 PM, By vjethnan

As part of the series ‘Extendscript of the week’, we are providing an extendscript utility to convert all the graphics in FM/Book “imported by copy” to “imported by reference”. In this process all graphics imported by copy will be created externally and then imported by reference. These externalize graphics will be created in same directory as source file is. Users have to make sure the source directory provides appropriate access.

A report will also be created,  displaying a table with entries for processed documents and all the graphics that has been converted for these documents. Graphics entry will be hyperlinked to the graphic in the doc.

Download the .rar file from Externalize Files. It contains all necessary files to be deployed.
UPDATE:  for all those people  who are having problems with .rar file above,  .zip file can be found here.

Contents:

  • Externalize.jsx:  Master script for the utility. Creates menu entry and handles commands, also has some logic for externalization.
  • Externalize\ExternalizeUtils.jsx:  Utility functions for the process.
  • Externalize\iterator.jsx:  A simple iterator for the book.
  • Externalize\ExternalizeTemplate:  Template doc for the report to be generated.
  • Externalize\ExternalLibrary.dll:  Library for writing graphic files to disk. Used as core java script “External Object” in utility.

Installation:

  • Download the zip file from Externalize Files.
  • Unzip the files and copy “Externalize.jsx” and “Externalize” folder in startup folder located at “C:\Program Files\Adobe\AdobeFrameMaker10\startup”. (Or you can simply run the Externalize.jsx manually, just make sure this script and Externalize folder resides in same directory)

If successful, there should be a new menu entry under “File->Utilities->Externalize Graphics“.

Usage:

  • Launch FrameMaker
  • Open any document Or book. (you can use sample files from ExternalizeSampleFiles)
  • Initiate externalize process from “File->Utilities->Externalize”
  • This will start the process and will generate the report in the end with the information listed above.

I hope this utility will be useful for many and will be a nice resource to those who want to dive into magnificent world of ExtendScript.

Thanks,
Vikas Jethnani,  Pankaj Aggrawal.
FrameMaker Engineering Team.

COMMENTS

  • By Linda Furlet - 3:49 PM on December 19, 2011  

    Is there a zip file? The .rar file from the links above does not appear to contain any files.

    • By vjethnan - 7:10 PM on December 19, 2011  

      Hi Linda, try going into “Externalize Files” folder until you see Externalize.jsx.
      Depending on how you extracted the .rar, you might have to go 1 or 2 level deep.

      • By Linda Furlet - 9:43 PM on December 19, 2011  

        There is nothing in the files for me to drill down to, including a folder. I tried extracting with a tool specifically designed for .rar files, and it failed to find anything.

        Other postings have had zip files. Can you attach zip files to this for those of us who may have problems with .rar files?

        • By vjethnan - 1:44 PM on December 20, 2011  

          I have updated the blog with .zip file also. Please try this new file.

  • By Yves Barbion - 7:49 AM on December 20, 2011  

    Seems to work well but I see 1 problem: the script converts my Illustrator EPS graphics to TIFF files. Is there a way to change this, i.e. keep the original graphic file format or, if this is not possible, give the user the choice between GIF, PNG, JPG (or PDF)?

  • By Mark Southee - 8:56 AM on December 20, 2011  

    Hi Linda, I use a free tool called IZarc which is free and handles every compression format going (I’m nothing to do with IZarc btw). Although winzip on the work pc I’m using handled the .rar no problem

  • By Roman - 4:52 PM on December 22, 2011  

    Although this is not related to this specific script, but I think it is important mentioning as an idea for “Extendscript of the Week”. I guess many Framemaker users have encountered the following issue in Framemaker: when adding a character format to a word/character inside a heading (while the rest of the heading has another format), the corresponding TOC link area is not or partially clickable. The reason for this is that the “foreign” character format somehow disrupts the hypertext command. The only workaround proposed on the Web is to use Framescript the duplicate the hypertext marker in the TOC entry each time the character format is changed. Is it possible to create an Extendscript that does that?

    Kind regards,
    Roman

  • By Roman - 10:35 AM on January 3, 2012  

    Hi,

    There are following problems with the Externalize script:

    1. Creates a directory called Insets (instead of Graphics)
    2. Exports the graphics as .dib and .tiff files instead of widely used formats (jpg, png, gif, bmp)
    3. Ignores the embedded Visio graphics.

    Kind regards,
    Roman

  • By Clare - 4:25 PM on February 3, 2012  

    Hello,

    Can anyone help? The zip package menu doesn’t install for me and when I run it externally I get what looks like an error on line 42: app.GetNamedMenu is not a function.

    Thanks,

    Clare

  • By louis - 10:28 AM on June 21, 2012  

    Hello,
    Can we get the ExternalLibrary.dll source? Because we want t recreate this lib for MacOS.Thanks.

  • By Terry Smith - 7:31 PM on June 7, 2013  

    I had a large Word document with nearly 300 pasted-in graphics that I desperately needed to convert to FrameMaker quickly I used this ExtendScript to change the graphics to external graphics. Here is what you need to know: the graphics exported as (mostly) FrameMaker Vector (FMV) files Very few programs (not Photoshop!) can open FMV files. I found only two that would work. One was an enterprise product (breathtakingly expensive and no trial available) and the other was Corel Paint I downloaded the trial of Corel Paint and found that I could not batch convert the pictures (screen captures) from FMV to another format (although Corel Paint does that for most formats) Instead, I opened each FMV and then saved it to PNG after doing a few tests to get settings that gave me exactly what I needed.(By the way, I bought the Corel Suite for home use after the trial because I was so pleased to find that several of the Corel products handle legacy formats of various sorts so well)

    So just know that this ExtendScript gives you files that are referenced externally, but not in a format you will want. You still need to convert them from FMV to something else

    I timed exporting the graphics various other ways (from the Word file, from a PDF file, retaking the captures that I no longer had the source for, and so on) and compared to what it would take to use this ExtendScript and then convert the exported graphics, the difference was between doing the project and not doing the project. I could not have completed the task this year without this ExtendScript (not that the project would have taken a year, but I had to squeeeeze the project into my schedule)

  • Categories

  • Archives

  • Authors

  • Useful Links

  • Recent Comments

    • Joel: Thanks for fixing the links guys!
    • Maxwell Hoffmann: Ted, one aspect of the blog that may have escaped your notice; you can launch the HTML5 version in...
    • Maxwell Hoffmann: Joel, per comments made above, I discovered that the original URLs were incorrect with pointers to...
    • Maxwell Hoffmann: Paul, as I indicated in the comments below, the original blog had links that pointed to a...
    • Maxwell Hoffmann: I apologize to all concerned regarding my suggestion to “clear the cache” … it...