Get content of textframe on specific layer and page
I've got an InDesign file with dozens of pages which I need to export as separate pages through a script. That part works fine but what I would like to do is name the exporting files after the content of a specific textframe on each page. The textframe is the only frame on a separate layer. What I currently have is this:
var _doc = app.activeDocument;
var _rangeFirst = parseInt(_range[0]) - 1;
var _rangeLast = parseInt(_range[_range.length - 1]);
var _textFrames = _doc.layers.item('myLayer').textFrames;
var _naming;
for (var k = _rangeFirst; k < _rangeLast; k++) {
_naming = _doc.pages[k].pageItems[{itemLayer : 'myLayer'}].textFrames[0].contents;
alert(_naming)
}I know that pageItems[{itemLayer : 'myLayer'}] does not work, VSC has been quite vocal about that ;). What is the correct syntax in this case? Any help is much appreciated.
