Highlighted

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

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

 

Adobe Community Professional
Correct answer by Manan Joshi | Adobe Community Professional

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

TOPICS
Scripting

Views

70

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

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

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

 

Adobe Community Professional
Correct answer by Manan Joshi | Adobe Community Professional

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

TOPICS
Scripting

Views

71

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
Jun 18, 2020 0
Adobe Community Professional ,
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
Reply
Loading...
Jun 18, 2020 1
YuqiW LATEST
New Here ,
Jun 18, 2020

Copy link to clipboard

Copied

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
Reply
Loading...
Jun 18, 2020 0