2 Replies Latest reply on Jun 29, 2009 7:20 AM by RockScript

    To lock text Frame through CSV file input

    RockScript Level 1

      i want to lock the lock the textframe even wise. But i input will be getting from csv file. ex if i enter 3;9 that particular page textFrame only lock.

       

      How to do. pls could anyone tell me.

        • 1. Re: To lock text Frame through CSV file input
          Thomas B. Nielsen Level 3

          The following should do the trick:

           

          if (app.documents.length > 0) {
              var myDocument = app.activeDocument;
              main();
          } else {
              alert("Please open a document");
          }
          function main () {
              var myFile = File.openDialog("Choose the file containing the semicolon separeted page list");

           

              var myResult = myFile.open("r", undefined, undefined);
             
              if(myResult == true){
                 
                  var myFileContent = myFile.read();
                  var myPageLockArray = myFileContent.split(";");
                  alert(myPageLockArray);
                 
                  for (i = 0; i < myPageLockArray.length; i++) {
                      var myPageNum = myPageLockArray[i] - 1;
                      try {
                          var myPage = myDocument.pages[myPageNum];
                          var myTextFrame = myPage.textFrames[0]; // Assuming there is only one textframe on the page
                          myTextFrame.locked = true;
                      } catch (e) {
                          alert(e);
                      }
                  }
                  myFile.close();
              }
          }

           

          --

          Thomas B. Nielsen

          http://www.nobrainer.dk

          • 2. Re: To lock text Frame through CSV file input
            RockScript Level 1

            Thank you nielse. it's very helpful to me.

             

            Thank u once again