2 Replies Latest reply on Feb 9, 2015 12:26 AM by K.Daube

    How to create a new FM-Doc

    K.Daube Level 1

      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

        • 1. Re: How to create a new FM-Doc
          Klaus Göbel Level 3

          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[i].propVal.ival = Constants.FV_AllowAllRefFilesUnFindable;
          
          
          
          
          
          
          
          i = GetPropIndex(params, Constants.FS_FileIsOldVersion);
          
          
          params[i].propVal.ival = Constants.FV_DoOK;
          
          
          
          
          
          
          i = GetPropIndex(params, Constants.FS_FontNotFoundInDoc);
          
          
          params[i].propVal.ival = Constants.FV_DoOK;
          
          
          
          
          
          
          i = GetPropIndex(params, Constants.FS_LockCantBeReset);
          
          
          params[i].propVal.ival = Constants.FV_DoOK;
          
          
          
          
          
          
          
          
          i = GetPropIndex(params, Constants.FS_FileIsInUse);
          
          
          params[i].propVal.ival = Constants.FV_OpenViewOnly;
          
          
          
          
          
          
          
          i=GetPropIndex(params,Constants.FS_AlertUserAboutFailure);
          
          
          
            params[i].propVal.ival=Constants.FV_DoCancel;
          
          
          
          i=GetPropIndex(params,Constants.FS_MakeVisible );
          
          
          params[i].propVal.ival=false;
          
          
          
          
          
          
          return (params);
          
          
          
          }
          
          
          • 2. Re: How to create a new FM-Doc
            K.Daube Level 1

            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.