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