0

In my document which contains a lot of pages i need to Find specific name of text Frame, and if script will find it copy found pages into another document

var textFrame = app.activeDocument.textFrames.everyItem().getElements();  
function doesLayerExist(layers, name) {
    for (i=0; i<layers.length; i++) {
        if (layers[i].name==name) return true;
    }
    return false;
}
if (doesLayerExist(app.activeDocument.layers, "SCRIPT")) {
alert("Warstwa Skrypt Istnieje");
if (textFrame[0].contents == "Test")
    {
        alert("Works!");
    }
if (textFrame[0].contents == "Test2")
    {
        alert("Works!");
    }
#......More if statements 
}
dizek
  • 3
  • 2
  • I'm not sure what your question is, but instead of multiple `If` statements, have you considered using [`Switch`](https://stackoverflow.com/questions/13207927/switch-statement-multiple-cases-in-javascript)? – cybernetic.nomad Jul 15 '19 at 15:18
  • Hi, im not accualy sure how to do it. – dizek Jul 16 '19 at 08:04
  • I see the "doesLayerExist" function. I think you need to make a similar function for "doesTextFrameExist" – user1754036 Jul 16 '19 at 15:01
  • Very confusing question. Looking at your description and code, you test against text in the text frame and not its name. What exactly does not work? – Nicolai Kant Jul 17 '19 at 13:34

0 Answers0