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

Create primaryTextFrame

Advocate ,
Nov 21, 2022 Nov 21, 2022

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
1.2K
Translate
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

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.

Translate
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

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

Viele Grüße
Mario
Translate
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

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

Translate
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

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
Translate
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

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
  }
);

 

Translate
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

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

Translate
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

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

Translate
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

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. 

Translate
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
LATEST
Translate
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