3 Replies Latest reply on Aug 8, 2013 10:24 PM by W_J_T

    Lock Selected objects

    surendarappu Level 1


      Any one please help me to use lock option in javascript

      i want to lock selected objects




        • 1. Re: Lock Selected objects
          Muppet Mark Level 5

          Some thing like this should do you…

          #target illustrator
          function lockSelection(){
              var i, doc, count, selectList;
              doc = app.activeDocument;
              selectList = doc.selection;
              count = selectList.length;
              if ( count > 0 ) {
                  for ( i = 0; i < count; i++ ) {
                      selectList[i].selected = false;
                      selectList[i].locked = true;
          • 2. Re: Lock Selected objects
            surendarappu Level 1

            Hi Muppet Mark


            Thank you above code working fine

            can you help me to hide instead of lock.




            • 3. Re: Lock Selected objects
              W_J_T Level 4

              surendarappu wrote:


              help me to hide instead of lock


              To modify/change the code provided by Muppet Mark, from locking to hiding, see the following:


              // Change this line...
              // selectList[i].locked = true;
              // To the following...
              selectList[i].hidden = true;


              You could also change the two references of "lockSelection" for the function name and call, to something like "hideSelection" to avoid confusion as well if needed.


              * Was this helpful?