We have a list of Framemaker document files (*.fm files) coming into a folder. We need to pick up these files and convert to xml format (same as the saveAs opertion from the File menu).
I have written the follwing function to Save fm files to xml
Code to Save fm files to xml files
function saveAsXml (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 (/\.[^\.\\]+$/,".xml");
var i = GetPropIndex(params, Constants.FS_FileType);
params[i].propVal.ival = Constants.FV_SaveFmtXml;
// Save the document as XML.
doc.Save(saveName, params, returnParamsp);
}
How to automate this process so that code checks -
- New fm files in the folder
- Saves the fm file as xml
- Moves the saved fm file to a different folder
Thanks
If you are on windows, you can write a simple batch file to run your extendscript in a loop via the batch file (.bat) from command line.