Automatically Saving to MIF

Adobe framemaker Frequently asked questions

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:

  • Copy the code below and paste it into an empty text file.
  • Save the text file to a convenient location with the name “SaveAsMif_Event.jsx”.
  • Quit FrameMaker if it is running.
  • Copy the file to C:\Users\\AppData\Roaming\Adobe\FrameMaker\\startup, where is your Windows login name and is the FrameMaker version that you are using. If the startup folder does not exist, create it.
  • 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);
}


Reference:
https://frameautomation.com/automatically-saving-to-mif/


Comments