Highlighted

Lock file

New Here ,
Apr 21, 2016

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.

Views

195

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more

Lock file

New Here ,
Apr 21, 2016

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.

Views

196

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Apr 21, 2016 0
_tikira_ LATEST
New Here ,
Apr 21, 2016

Copy link to clipboard

Copied

Oh, it's a typo!

Not FE_DocModified but FF_CLOSE_MODIFIED

Likes

Translate

Translate

Report

Report
Community Guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
Reply
Loading...
Apr 21, 2016 0