Copy link to clipboard
Copied
Hi!
I am using ExtendScript to save .fm file as .mif. It works well but there is one issue: filename.fm.lck file is not removed when I close the document.
The code sample (without error handling etc.) is below.
var doc = OpenDoc(FileName);
var importDoc = OpenDoc(ImportFileName);
var res = doc.SimpleImportFormats(importDoc, Constants.FF_UFF_COND);
var saveParams = GetSaveDefaultParams();
var i = GetPropIndex(saveParams, Constants.FS_FileType);
saveParams.propVal.ival = Constants.FV_SaveFmtInterchange;
i = GetPropIndex(saveParams, Constants.FS_SaveMode);
saveParams.propVal.ival = Constants.FV_ModeSaveAs;
i = GetPropIndex(saveParams, Constants.FS_AutoBackupOnSave);
saveParams.propVal.ival = Constants.FV_SaveNoAutoBackup;
var saveName = doc.Name.replace(/\.[^\.\\]+$/,".mif");
var retParamsp = new PropVals();
doc.Save(saveName, saveParams, retParamsp);
doc.Close(Constants.FE_DocModified);
importDoc.Close(Constants.FE_DocModified);
where OpenDoc() is a simple wrapper on Open() with open params configured to open file anyway on different situations (like unavailable fonts etc) and to do not make it visible.
What is wrong? Is doc corresponds to .mif file after saving, not to .fm file? And how can I close source file in that way?
Thanks for help.
Copy link to clipboard
Copied
Oh, it's a typo!
Not FE_DocModified but FF_CLOSE_MODIFIED