3 Replies Latest reply on Oct 30, 2008 9:57 AM by Kasyan Servetsky

    Scripting layers

    sotospeak (carlo bazzo) Level 1
      I did not find much in the scripting guide and here found just some examples in applescript.

      I want to perform a search in JS but just in one layer of my document.

      How can I do it?
      Additionally, is there any method to set a layer in the locked or hidden state?

      thank you
      carlo
        • 1. Re: Scripting layers
          Kasyan Servetsky Level 5
          >I want to perform a search in JS but just in one layer of my document.

          If you want to perform a search in text frames then you can check itemLayer property.

          >is there any method to set a layer in the locked or hidden state?

          myLayer.locked = true;
          myLayer.visible = false;
          • 2. Re: Scripting layers
            sotospeak (carlo bazzo) Level 1
            Thank you.

            Actually I want the search performed in all the document, this way:

            var s_regexp='\\[.*\\]'
            app.findGrepPreferences.findWhat = s_regexp;
            var myFoundItems = app.documents.item(0).findGrep(true);

            What I noticed is that if you have two layers in the document with the same content then myFoundItems contains the same items twice (so the research is performed in both the layers).

            Is there any way to set the research just in one layer?

            Alternatively I should dynamically set locked all the layers but the one interesetd by the search.

            carlo
            • 3. Re: Scripting layers
              Kasyan Servetsky Level 5
              >Is there any way to set the research just in one layer?

              I don't think it's possible to do directly.

              >Alternatively I should dynamically set locked all the layers but the one interesetd by the search.

              That's good idea, just lock temporarily all layers except the active one and perform a search.

              Kasyan