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

How can I create a tex frame on a specific layer on a specific page range with script?

Community Beginner ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

I need to create a text frame on a specific layer on a specified range of pages. 

 

Here's part of my scripts inside of a function 

 

myLayer = myDoc.layers.itemByName("DATE");

myPage = myDoc.pages[i];

rect = myPage.textFrames.add({layer:myLayer, geometricBounds : [158,91,183,330]});

 

I end up getting the texts created on the current active layer instead of the "DATE" one. Anyone could tell me what went wrong in my scripts? or any alternative ways I can achieve this?

 

Thanks

 

TOPICS
Scripting

Views

365

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 , Jun 18, 2020 Jun 18, 2020

The property you are looking for is itemLayer and not Layer. So the last line should be changed to

 

rect = myPage.textFrames.add({itemLayer:myLayer, geometricBounds : [158,91,183,330]});

 

 

For more properties/methods available on textframe object, see the following

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

 

-Manan

Votes

Translate

Translate
Community Expert ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

The property you are looking for is itemLayer and not Layer. So the last line should be changed to

 

rect = myPage.textFrames.add({itemLayer:myLayer, geometricBounds : [158,91,183,330]});

 

 

For more properties/methods available on textframe object, see the following

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

 

-Manan

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 Beginner ,
Jun 18, 2020 Jun 18, 2020

Copy link to clipboard

Copied

LATEST

Hi Manan

It worked!!!

Thank you very much!!!

I guess I'll get a lot of help and improve my scripting skills here 🙂

Yuqi

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