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

Create primaryTextFrame

Advocate ,
Nov 21, 2022 Nov 21, 2022

Copy link to clipboard

Copied

Hello,
per script I want to create a new MasterPage and create a primaryTextFrame on it? TextFrame is no problem, but I can't get it set to primary.

Viele Grüße
Mario
TOPICS
Scripting

Views

882

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 ,
Nov 21, 2022 Nov 21, 2022

Copy link to clipboard

Copied

Click on the symbol on the upper part of the left edge of the text frame once. It will change it to a primary text frame.

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
Advocate ,
Nov 21, 2022 Nov 21, 2022

Copy link to clipboard

Copied

Hello,
yes, but I want to create it via JavaScript.

Viele Grüße
Mario

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 ,
Nov 21, 2022 Nov 21, 2022

Copy link to clipboard

Copied

Why do you want a script, when a single click will solve your problem?

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
Advocate ,
Nov 21, 2022 Nov 21, 2022

Copy link to clipboard

Copied

It is only a small part of a script. I want to create a new document with several pages. For this I need a primaryTextFrame for different MasterPages

Viele Grüße
Mario

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 ,
Nov 21, 2022 Nov 21, 2022

Copy link to clipboard

Copied

There's a property createPrimaryTextFrame, which is a creation property, that is, you have to set the property when you create a document. You can't change an existing frame to a primary frame. here's how to use it:

 

 

doc = app.documents.add ({
  documentPreferences: {
    createPrimaryTextFrame: true,
    // And whatever else
  }
);

 

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 ,
Nov 21, 2022 Nov 21, 2022

Copy link to clipboard

Copied

The MasterSpread object has a primaryTextFrame property. I've enver used it but I would imagine it would be something like: 

myParentSpread.primaryTextFrame = myParentSpread.textFrames.add();

 

https://www.indesignjs.de/extendscriptAPI/indesign-latest/#MasterSpread.html

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 ,
Nov 21, 2022 Nov 21, 2022

Copy link to clipboard

Copied

Nope, doesn't work: "Invalid object for this request".

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 ,
Nov 21, 2022 Nov 21, 2022

Copy link to clipboard

Copied

Hmm, bug? If you have a PTF set on the parent, then mySpread.primaryTextFrame.isValid is true, but you're right, doesn't seem you can set it on the fly. Weird. 

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 ,
Nov 21, 2022 Nov 21, 2022

Copy link to clipboard

Copied

LATEST

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