Copy link to clipboard
Copied
Hello,
I'm trying to create a script that go to the Right Master Page used in my document and create a round rectangle (at pos x, y and size h,w).
But i can't go to the right page. (I'm already in the Master Page View, using Fcodes)
I'm using :
Fcodes([app.GetNamedCommand("GotoPage").Fcode]);
I have the GotoPage dialog box, but how can i force it to got to the page named : RightMasterPageEnglish intead having the dialog box?
I'm trying with RoundRectanble too, but how to define the x,y,h and w parameters to past with the fcodes ?
Fcodes are not really the way to go about this. You are very limited when you use Fcodes because they just mimic what you can do in the interface. With scripting, you can do things directly without switching pages, etc. To answer your question, here is a way to go to the master page without using Fcodes:
...#target framemaker
var doc = app.ActiveDoc;
// Get the master page object.
var page = doc.GetNamedMasterPage ("RightMasterPageEnglish");
// If the master page exists, go to it.
if (page.ObjectValid ()
Copy link to clipboard
Copied
Fcodes are not really the way to go about this. You are very limited when you use Fcodes because they just mimic what you can do in the interface. With scripting, you can do things directly without switching pages, etc. To answer your question, here is a way to go to the master page without using Fcodes:
#target framemaker
var doc = app.ActiveDoc;
// Get the master page object.
var page = doc.GetNamedMasterPage ("RightMasterPageEnglish");
// If the master page exists, go to it.
if (page.ObjectValid () === 1) {
doc.CurrentPage = page;
}
But you don't even need to do go to the master page to draw something on it.
#target framemaker
var doc = app.ActiveDoc;
// Get the master page object.
var page = doc.GetNamedMasterPage ("RightMasterPageEnglish");
// Draw an object on the page.
var roundRect = doc.NewRoundRect (page.PageFrame);
roundRect.LocX = 2 * 72 * 65536; // 2 inches from the left.
roundRect.LocY = 2 * 72 * 65536; // 2 inches from the top.
roundRect.Width = 2 * 72 * 65536; // 2 inches width.
roundRect.Height = 2 * 72 * 65536; // 2 inches height.
I have written thousands of scripts, both in FrameScript and ExtendScript and almost never use Fcodes.
-Rick
Copy link to clipboard
Copied
Thanks Rick, always the good answer
Help a lot your answer, now juste need to loop the book to put my grey tab on the right pos.