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

New Here ,
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

127

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
community guidelines

correct answers 1 Correct Answer

Adobe Community Professional , 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

Likes

Translate

Translate
Adobe Community Professional ,
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

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
community guidelines
New Here ,
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

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
community guidelines