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

Gotopage and RoundRectangle

Explorer ,
Mar 16, 2017 Mar 16, 2017

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 ?

TOPICS
Scripting

Views

418

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

Community Expert , Mar 16, 2017 Mar 16, 2017

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 ()

...

Votes

Translate

Translate
Community Expert ,
Mar 16, 2017 Mar 16, 2017

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

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
Explorer ,
Mar 17, 2017 Mar 17, 2017

Copy link to clipboard

Copied

LATEST

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.

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