Highlighted

Gotopage and RoundRectangle

Explorer ,
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 ?

Adobe Community Professional
Correct answer by frameexpert | Adobe Community Professional

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

TOPICS
Scripting

Views

287

Likes

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

Gotopage and RoundRectangle

Explorer ,
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 ?

Adobe Community Professional
Correct answer by frameexpert | Adobe Community Professional

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

TOPICS
Scripting

Views

288

Likes

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
Mar 16, 2017 0
Adobe Community Professional ,
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

Likes

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
Reply
Loading...
Mar 16, 2017 0
Explorer ,
Mar 17, 2017

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.

Likes

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
Reply
Loading...
Mar 17, 2017 0