Script for loop all items
Hello all,
I could use a little help, maybe you can help me?
I have on a layer "LayerX" text fields in a group with certain name "TextX".
There are several groups on the layer with the same text fields and I want to apply my script to all text fields in the document with the name "TextX".
but unfortunately i can't get the loop to run it only selects the 1st "TextX" on the layer "LayerX" and then the script stops.
try{
var myDoc = app.documents[0];
var myLoop = myDoc.allPageItems;
for(var i = 0; i < myLoop.length; i++){
var doc = app.documents[0];
app.select(NothingEnum.NOTHING);
doc.layers.itemByName("LayerX").pageItems.itemByName("TestX").select(SelectionOptions.ADD_TO);
var myStory = app.selection[0].parentStory;
var myOversetEnd = myStory.characters.length-1;
var myOverset = myStory.characters.itemByRange(4, myOversetEnd);
myOverset.remove();}
}catch(e){alert("Something gone wrong!" + e);};
