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)
// prop num = 1 String value =
// prop num = 2 Integer value = 0
// prop num = 3 Unsigned Integer values are:
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.
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.