Automatically Saving to MIF

It is not unusual to have “mixed” FrameMaker workflows where members of a team are using different versions of FrameMaker. Documents saved in a lower version can be opened with higher versions, but you can’t open documents saved with a higher version with a lower version of FrameMaker. There are two solutions: First, you can use the higher version to “save down” to the lower version. However, you can only save down to the next lowest version, for example, from FrameMaker 12 to FrameMaker 11. Second, you can save the document to MIF (Maker Interchange Format) in which case you can open it with any lower version of FrameMaker.

The main sticking point with saving to MIF is that you have to remember to do it. But with ExtendScript, you can automate this. You can create a script that will automatically save the document to MIF whenever you choose File > Save or press Control+S. When you are ready to pass the MIF file onto another team member that may be using a lower FrameMaker version, you know that it will always reflect the latest saved changes.

Here is how to set up the script below:

  1. Copy the code below and paste it into an empty text file.
  2. Save the text file to a convenient location with the name “SaveAsMif_Event.jsx”.
  3. Quit FrameMaker if it is running.
  4. Copy the file to C:\Users\<UserName>\AppData\Roaming\Adobe\FrameMaker\<Version>\startup, where <UserName> is your Windows login name and <Version> is the FrameMaker version that you are using. If the startup folder does not exist, create it.
  5. Start FrameMaker and test the script. Open a document, make some changes to it, and save it. You should see a corresponding MIF file in the same folder as the document.

If you have any questions, problems, or comments, please post them in the comments section. Here is a link to a video that walks through the creation of the script.

Notification (Constants.FA_Note_PostSaveDoc, true);

function Notify (note, object, sparam, iparam) {

    switch (note) {
        case Constants.FA_Note_PostSaveDoc :
        saveAsMif (object);
        break;
    }
}

function saveAsMif (doc) {
	
	// Get required parameters for the save function.
    var params = GetSaveDefaultParams();
    var returnParamsp = new PropVals();
    
    // Replace the .fm extension with .mif.
    var saveName = doc.Name.replace (/\.[^\.\\]+$/,".mif");
    
    // Get the FileType save parameter and set it to MIF.
    var i = GetPropIndex(params, Constants.FS_FileType);
    params[i].propVal.ival = Constants.FV_SaveFmtInterchange;

    // Save the document as MIF.
    doc.Save(saveName, params, returnParamsp);
}

5 thoughts on “Automatically Saving to MIF”

  1. Hi there,

    first of all THANK YOU for your nice and useful script.
    Now I have one question. Is it possible to modify this script so that i
    can convert the created mif files into fm files after translating them?
    What parameters do I have to change to do so?

    I’m looking forward hearing from you.

    Best regards

    Christian

  2. Hi I don’t need this script anymore and I deleted it from the sturtup folder but still get en error that FM can’t find the script. How can I get rid of it? Thank you in advance for your answer.

  3. Jacek, Are still having problems with this? Let me know and I will be glad to help you. -Rick

  4. Hi, thanks for the script :). I know, this comment thread is a bit old but I still would like to ask a question

    I’m having a problem whenever I save a file with this script beiing active. A warning appears saying that “an internal error occurred with imported graphics in this document.”. Then, an additional file with a weird suffix is created in the directory besides the FM file. I’m using imported graphics on my reference pages for security symbols, callouts and the like.

    Is this only me or does someone else have a similar problem? Is there a solution maybe that my Google skills can’t find? Any hints would be greatly appreciated.

    Thanks in advance
    Tom
    Technical writer from Germany

  5. Hello and thank you very much for this helpful script!

    Best regards,
    Wolfram Heinz
    AVL Emission Test Systems GmbH, Germany

Leave a Reply

Your email address will not be published. Required fields are marked *