• Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
Exit
0

How to create a new FM-Doc

Community Expert ,
Feb 07, 2015 Feb 07, 2015

Copy link to clipboard

Copied

Dear all

I see how to create a new book-component,

var comp = book.NewSeriesBookComponent(0);
comp.Name = "C:\\SomeDocumentPath";

but all I want is creating a new independent FM-document, write something to it, (which i have collected from the docs of a book or a singualer doc).

Any ideas?

Thank You

TOPICS
Scripting

Views

582

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
community guidelines

correct answers 1 Correct answer

Enthusiast , Feb 07, 2015 Feb 07, 2015

To create a document, you only have to open it:

ADOBE FRAMEMAKER SCRIPTING GUIDE says:

Open

Description

Opens a document or book. It can also create a new document.

Open() allows you to specify a property list telling FrameMaker how to open or create the file and how to deal with error and warning conditions.

For example, you can specify whether to abort or to continue opening a document if it contains fonts that are not available. If the file is already open and invisible, it will make the file v

...

Votes

Translate

Translate
Enthusiast ,
Feb 07, 2015 Feb 07, 2015

Copy link to clipboard

Copied

To create a document, you only have to open it:

ADOBE FRAMEMAKER SCRIPTING GUIDE says:

Open

Description

Opens a document or book. It can also create a new document.

Open() allows you to specify a property list telling FrameMaker how to open or create the file and how to deal with error and warning conditions.

For example, you can specify whether to abort or to continue opening a document if it contains fonts that are not available. If the file is already open and invisible, it will make the file visible.

Hope that helps

cu

Klaus

EDIT:

Here's an example:

var openParams, openReturnParams;
openParams = GetOpenDefaultParams();
openReturnParams new PropVals();
var  MyFile = "C:\\MyPath\\MyFile.fm";
oFile = Open(MyFile,openParams, openReturnParams);

And if you want to change the parameters:

var openParams, openReturnParams;
openParams = getYourParams ();
openReturnParams =  new PropVals();
var  MyFile = "C:\\MyPath\\MyFile.fm";
oFile = Open(MyFile,openParams, openReturnParams);

function getYourParams() {

var params, i;
/*
Change the params
*/
i = GetPropIndex(params, Constants.FS_RefFileNotFound);
params.propVal.ival = Constants.FV_AllowAllRefFilesUnFindable;
i = GetPropIndex(params, Constants.FS_FileIsOldVersion);
params.propVal.ival = Constants.FV_DoOK;
i = GetPropIndex(params, Constants.FS_FontNotFoundInDoc);
params.propVal.ival = Constants.FV_DoOK;
i = GetPropIndex(params, Constants.FS_LockCantBeReset);
params.propVal.ival = Constants.FV_DoOK;
i = GetPropIndex(params, Constants.FS_FileIsInUse);
params.propVal.ival = Constants.FV_OpenViewOnly;
i=GetPropIndex(params,Constants.FS_AlertUserAboutFailure);

  params.propVal.ival=Constants.FV_DoCancel;

i=GetPropIndex(params,Constants.FS_MakeVisible );
params.propVal.ival=false;
return (params);

}

Votes

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
community guidelines
Community Expert ,
Feb 09, 2015 Feb 09, 2015

Copy link to clipboard

Copied

LATEST

Hello Klaus,

During the weekend I had the same idea.

Opening a template file provides full blown style definitions etc. In my case I will add the template to the script directory (where I anyway have an ini-file also). The filled up file will then be stored to the location of the source files.

Votes

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
community guidelines