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

How do I create a new FM document using Extendscript?

Community Beginner ,
Jan 20, 2021 Jan 20, 2021

Copy link to clipboard

Copied

How do I create a new document in FrameMaker using Extendscript without prompting the user? I'd like to duplicate the functionality of the user doing "File" -> "New..." -> "New Document", then selecting the "Portrait" button.

 

I think I either need to figure out how to programatically locate the "Portrait" template file and pass that as the filename, or maybe there is a open parameter I can specify that says to use the Portrait template.

 

Here is the code I have so far:

 

var filename = undefined;
var oParams = GetOpenDefaultParams();
var rParams = new PropVals();

oParams[GetPropIndex(oParams, Constants.FS_NewDoc     )].propVal.ival = true;
oParams[GetPropIndex(oParams, Constants.FS_ShowBrowser)].propVal.ival = false;

var doc = Open(filename, oParams, rParams);
if (doc.ObjectValid() == false)
    PrintPropVals(rParams);

// PropVals
// --------
//     prop num = 1 String value = 
//     prop num = 2 Integer value = 0
//     prop num = 3 Unsigned Integer values are:
//     0
//     0
//     8
//     0
//     0

 

TOPICS
Getting started , Scripting

Views

135

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 Beginner ,
Jan 20, 2021 Jan 20, 2021

Copy link to clipboard

Copied

I found this question/answer (Newbie Question #1: Creating New Document ) after posting my question via the Related Conversations list. It's good enough for what I need, but it would be interesting to see if there is a more idiomatic way of creating a new portrait or landscape document. I don't know if this is possible, but if the default portrait or landscape template was changed, this would not produce the desired results.

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 ,
Jan 20, 2021 Jan 20, 2021

Copy link to clipboard

Copied

LATEST

Hi. If this is a concern, you may want to make your own template and store it in convenient folder. That way, you can create a new document based on the template and you wan't have to specify all of the individual parameters. I don't have time to post code to do it, but it looks like you have a pretty good start on it.

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