17 Replies Latest reply on Apr 24, 2014 5:55 AM by essejesse

    Errors and more, my first illustrator script

    essejesse Level 1

      First, I should mention that I started scripting for Photoshop about a month ago and have had some really motivating successes there. It led me to this one task we have that is just incredibly repetitive and boring in Illustrator that I want to script.

       

      I haven't gotten all the pieces in here that I need so far, and any form of help would be greatly appreciated, whether just suggestion, or really whatever. I don't mind doing research and trying things out myself.

       

      The purpose of this script is to open a template file we have on our network drive, ask for a folder with a collection of files (these are files provided to us that contain the info we need to make labels), place one, save with a specific name, and start over, placing the next file, till they are all on the template. We do this before we can create labels for our products. There are weeks when it has to be done 50+ times and that's pretty mind-numbing.

       

      The steps I think I need are:

      • ask where the provided files are that need to be placed
      • open template file
      • make sure the folder chosen has the right type of stuff in it (PDFs)
      • place the first file at specified coordinates
      • embed the link
      • lock the embedded link
      • ask user to proof information on screen (ok to continue, cancel to stop and let user interact with file on their own) (95% of the time, there are no errors)
      • use the embedded link's name as the name of the file and save it to a specific network location
      • repeat until all the files in the chosen folder have been done

       

      I've been lurking around here for a couple days, reading up on how Illustrator works with scripting and have broken off bits and pieces of different scripts to adapt for my purposes. So far, this is what I've come up with:

       

      function getLabelRequests() {

           return Folder.selectDialog('Please select the folder containing label requests:', Folder('~/Desktop'));

           }

       

           function placeLabelRequests(selectedFolder) {

                var myDoc;

       

                if (selectedFolder) {

                var fileRef = File("/Volumes/myNetworkLocation/myTemplateFile.ai")

                open(fileRef);

                myDoc = app.activeDocument;

       

                var firstImageLayer = true;

                var thisPlacedItem;

       

                // create document list from files in selected folder

                var fileList = selectedFolder.getFiles();

       

                for (var i = 0; i < fileList.length; i++) {

                // open each document in file list

                if (fileList[i] instanceof File) {

                // get the file name

                var fName = fileList[i].name;

                // check for supported file formats

                if( (fName.indexOf(".pdf") == -1)) {

                     // skip unsupported formats

                     continue;

                     } else {

                          // Give the file the name of the image file

                          File.name = fName.substring(0, fName.indexOf(".") );

       

                          // Place the label request on the artboard

                          thisPlacedItem = myDoc.layers['Job Form'].placedItems.add();

                          thisPlacedItem.file = fileList[i];

                          thisPlacedItem.position = [15,-45];

                          thisPlacedItem.embed();

                          }

                     }

                }

           }

       

           if( firstImageLayer ) {

           // display error message

           alert("Sorry, but the designated folder does not contain any recognized image formats.\n\nPlease choose another folder.");

           myDoc.close();

           getLabelRequests (placeLabelRequests());

           }

       

           else {

           // display error message

           alert("Rerun the script and choose a folder with label requests, if you please.");

           }

      }

       

      // Start the script off

      placeLabelRequests (getLabelRequests ());

       

       

      So obviously there's no loop in there, which is one of my problems at this point. I know what each of these chunks of code do, but can't necessarily understand all the syntax. Particularly things like

      for (var i = 0; i < fileList.length; i++) {

      I know it's saying that the variable i is zero, and while the list of files is greater than i, do whatever that last bit means, but I don't really know why it works or how it was constructed originally.

       

      I haven't specified the save either, which might be why I'm running another of my problems, but I don't know how to get the name of the link to be the name of the file when it's saved. I also haven't given it a confirm to let the user proof either.

       

      Here's my list of problems:

      • Running the script returns the image format error, even though the folder selected contains PDFs (I suppose I don't need to confirm the files are PDFs, that could just be incumbent upon the user)
      • Running the script places all the files into one iteration of the template (this may be because I haven't gotten the save or the loop in there, but I think it has more to do with the function being set up the way it is)
      • Obviously, it doesn't save with the link name as the file name
      • I don't seem to be able to figure out how to lock the link after it's embedded.

       

      I also wonder if there's a way to, rather than opening-placing-saving-closing-repeat, to open-place-save, delete-placenext-save, delete-placenext-save.

       

      Phew, sorry for the short novel.

       

      Here is a copy of the template … or not. Can I not embed files in the post that aren't images?

       

      Here's a JPG of the AI file that I use as a template

      Label Job Form-5C-01.jpg

      This document has two layers in this order normally:

      Artwork

      Job Form

       

       

      And here are the blocks I'm using as placement for the information we are provided. These are taking the place of the files that need to be placed, and again, were PDF files, but I'm uploading as JPGs because I either don't know what I'm doing, or you can't upoad those file types.

      PlaceMe.jpg

      PlaceMe 2.jpg

      PlaceMe 3.jpg

        • 1. Re: Errors and more, my first illustrator script
          JoshK105

          Whew, you have a lot going on here. Let's see what parts we can help you with and/or point you the right direction.

          (1) i++ : Whenever you add ++ at the end of a variable assuming it's a number it will increment that variable by 1.

          (2) What is happening in that for loop is that when you got a list of files each one was assigned an index number (which i equals) and so it is cycling through each file in that list of files.

          (3) Not having the save set up yet is why you are running into a majority of your problems. I would recommend, if you haven't already, checking out http://jongware.mit.edu/iljscs6html/iljscs6/ You'll be able to find (look under document) information on how to save a file including how to save it with a different name. It can be confusing at times, so if you're having trouble implementing it let us know and we'll try to help you.

          (4) Locking the link once it's embedded is simply a matter of changing a propery. Again the jongware site should be helpful, especially if you consider the placed item as a PageItem.

          1 person found this helpful
          • 2. Re: Errors and more, my first illustrator script
            essejesse Level 1

            Great, thank you. I'm checking out that site now. I'll try to implement my save as and see what happens. I'm sure I'll have questions.

            • 3. Re: Errors and more, my first illustrator script
              essejesse Level 1

              Ok, so I've been digging around and have simplified some of the things in the script. A couple of stumbling blocks for me still.

              • I've put a save in with just a few specified options, and that's saving fine, but I still can't seem to figure out how to take the name of the placed file and use that as the name of the file I'm saving.
              • I've tried to lock the placed item after embedding, but I'm still doing something wrong there.
              • I've put in a confirm step as we need to proof the placed file before it gets saved out. Even though the confirm comes after the place, nothing shows up till after the confirm step, so you can't actually proof it :\

              Here's my current, still not working right code with some notes inline where errors are occurring:

               

              #target Illustrator

              app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

              function getLabelRequests() {

                  return Folder.selectDialog('Please select the folder containing label requests:', Folder('~/Desktop'));

              }

               

               

              function placeLabelRequests(selectedFolder) {

                  var myDoc;

               

               

                  if (selectedFolder) {

                      var fileRef = File("/Volumes/graphics/Standards/Job Forms/Label Job Form-5C.ai")

                      open(fileRef);

                      myDoc = app.activeDocument;

                     

                      var thisPlacedItem;

                     

                      // create document list from files in selected folder

                      var fileList = selectedFolder.getFiles();

               

                      for (var i = 0; i < fileList.length; i++) {

                          // open each document in file list

                          if (fileList[i] instanceof File) {

                              // Place the label request on the artboard

                              thisPlacedItem = myDoc.layers['Job Form'].placedItems.add();

                              thisPlacedItem.file = fileList[i];

                              thisPlacedItem.position = [15,-45];

                              var newName = thisPlacedItem.name//trying to access the name of the placed item

                              myDoc.rename(newName);//this line gives me an error about it not being a function. The Object Model Viewer says it's a boolean, which either is helpful to me but I don't get how, or isn't helpful and I need something different to rename the file. I've tried a couple different ways of writing it, with true in there, without the () part, all sorts of stuff that didn't work.

                              thisPlacedItem.embed();

                              myDoc.PageItem.selected.locked = true//this give me an error that something is undefined, but myDoc is. I think I'm just writing it wrong. I want to reference the selected page item, which is by default what I just placed and embedded, and then lock it.

                              //make sure the placed job form has the correct information

                              var proof = confirm ("Does the job form have the correct information?", true, "Please Proof") //this confirm shows up fine, but the placed art doesn't, so it's impossible to proof. As soon as you hit yes or no, it shows up. I'm not sure why it does it in the wrong order since the place is first, then the confirm. It's like it hasn't had time to display the placed file yet.

                              if (proof) {

                                  IllustratorSaveOptions = new IllustratorSaveOptions()

                                  IllustratorSaveOptions.compatibility.ILLUSTRATOR15 //some of our printers have yet to upgrade

                                  var onPO = Folder ('/Volumes/graphics/ •••Drafts•••/ • Draft Labels/ •On PO')

                                  myDoc.saveAs (onPO, IllustratorSaveOptions)

                              }

                          }

                      }

                  }

               

               

                  else {

                      // if user cancels action, display message

                      alert("Rerun the script and choose a folder with label requests.");

                  }

              }

               

               

              // run the script

              placeLabelRequests (getLabelRequests ());

              • 4. Re: Errors and more, my first illustrator script
                essejesse Level 1

                I should also mention that I need to at some point after the save, but before the placement of the next file in the list, either start fresh from the job form template, or delete the previously placed art.

                • 5. Re: Errors and more, my first illustrator script
                  essejesse Level 1

                  I found the redraw() function to make illustrator show changes it's done before displaying the confirm. So that part works now.

                  1 person found this helpful
                  • 6. Re: Errors and more, my first illustrator script
                    essejesse Level 1

                    Holy crap, I've been going about the name of the file all wrong. I don't know why I didn't realize that the save function needs to be where the name is changed. OBVIOUSLY!

                     

                    So I had done all this work, over and over and over. Trying to understand why the pieces I was trying to manipulate weren't changing. I kept referencing the site you mentioned and would see read only, but for some reason kept going about it working with things I wasn't allowed to change.

                     

                    Well I finally just realized from reading other scripts that the name can be specified along with the save location, by bundling two variables into one. Here's what I did to make it work at the end. I won't embarass myself any more than I already have by showing all the failed attempts to do this.

                     

                     

                    IllustratorSaveOptions = new IllustratorSaveOptions()

                    IllustratorSaveOptions.compatibility.ILLUSTRATOR15 //some of our printers have yet to upgrade

                    var onPO = Folder ('/Volumes/graphics/ •••Drafts•••/ • Draft Labels/ •On PO')

                    var saveFile = File(onPO + '/' + myLinkName);

                    myDoc.saveAs (saveFile, IllustratorSaveOptions)

                     

                     

                    myLinkName is the name of a file I linked earlier, the intended source for the new file name.

                     

                    So, I had three major issues, now I've only got one. I still need to lock the selected page item after embedding it.

                     

                    1 person found this helpful
                    • 7. Re: Errors and more, my first illustrator script
                      JoshK105 Level 1

                      Good work. I was guessing that's what you needed to do to specify the file name, but hadn't had a chance to try it myself to verify.

                       

                      I'm guessing to lock the placed item you should be able to just do:

                       

                      thisPlacedItem.locked = true;

                       

                      See if that works, and if not, we can look at other options.

                      • 8. Re: Errors and more, my first illustrator script
                        JoshK105 Level 1

                        Oh, and don't feel too much like an idiot. Getting Illustrator to script well is something that takes a while and often results in running up many different paths until it eventually works for you. I've had plenty of moments where I've been banging my head against the wall trying to figure out why something does or doesn't work (Illustrator has many quirks)

                        • 9. Re: Errors and more, my first illustrator script
                          essejesse Level 1

                          I'll put that in and see what happens. I had thought that might be it, but was worried I wouldn't be able to then embed the file, and if I embed first, thisPlacedItem is no longer there, so I wasn't sure if telling it to lock would work.

                           

                          gimme a minute.

                          • 10. Re: Errors and more, my first illustrator script
                            essejesse Level 1

                            thanks

                             

                            however stupid I feel is miniscule in comparison to the excitement I feel from finally figuring it out.

                            • 11. Re: Errors and more, my first illustrator script
                              JoshK105 Level 1

                              If that doesn't work then:

                              myDoc.placedItems[0].locked = true;

                               

                              should most likely work for you as long as you only have one placed item in your document.

                              1 person found this helpful
                              • 12. Re: Errors and more, my first illustrator script
                                essejesse Level 1

                                thisPlacedItem.locked = true;

                                totally works, but I'm confused. If I'm using illustrator and I place a file, lock it, and then try to embed it, I get an error that it can't be embedded because it's locked.

                                 

                                Doing this same action through a script doesn't encounter the same issue.

                                 

                                 

                                Also, I just realized my test files I was placing are not representative. That block I'm placing is the shape of the bounding box we place. It's usually a large chunck of text.

                                 

                                Is there a way to specify that the placed items need to be placed using the bounding box, rather than anything else? If it places the art, or trim, or anything, I get a full 8.5 x 11. 

                                • 13. Re: Errors and more, my first illustrator script
                                  essejesse Level 1

                                  Latest code with my place options problem noted inline. I found a thread on apple's mailing lists (which, by the way, what is this? I'd hate to have my emails just floating around like that) which showed me that you can specify the PDF file options to determine what the crop is when a PDF is opened, but I seem to be inserting this in the wrong place or it can't be used with place. If it can't be used with place, how do you script that GUI feature?.

                                   

                                  #target Illustrator

                                  app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

                                  function getLabelRequests() {

                                      return Folder.selectDialog('Please select the folder containing label requests:', Folder('~/Desktop'));

                                  }

                                   

                                   

                                  function placeLabelRequests(selectedFolder) {

                                      var myDoc;

                                   

                                   

                                      if (selectedFolder) {

                                          var fileRef = File("/Volumes/graphics/Standards/Job Forms/Label Job Form-5C.ai")

                                         

                                         

                                          var thisPlacedItem;

                                         

                                          // create document list from files in selected folder

                                          var fileList = selectedFolder.getFiles("*.pdf");

                                   

                                          for (var i = 0; i < fileList.length; i++) {

                                              // open each document in file list

                                              if (fileList[i] instanceof File) {

                                                  //open job form

                                                  open(fileRef);

                                                  myDoc = app.activeDocument;

                                                  //Specify the PDF place options

                                                  var pdfOpts = app.preferences.PDFFileOptions

                                                  pdfOpts.PDFCropToBox = PDFBoxType.PDFBOUNDINGBOX;

                                                  // Place the label request on the artboard

                                                  thisPlacedItem = myDoc.layers['Job Form'].placedItems.add();//my place options aren't working here. I took them out of the add() parentheses.

                                                  thisPlacedItem.file = fileList[i];

                                                  thisPlacedItem.position = [15,-45];

                                                  redraw()

                                                  //var myName = thisPlacedItem.name; DIDN'T WORK

                                                  var myLinkName = myDoc.placedItems[0].file.name

                                                  thisPlacedItem.locked=true

                                                  thisPlacedItem.embed();

                                                 

                                                  //make sure the placed job form has the correct information

                                                  var proof = confirm ("Does the job form have the correct information?", true)//needs the redraw step above or nothing shows when the alert happens. Redraw forces Illustrator to display the actions performed so far.

                                                  if (proof) {

                                                      IllustratorSaveOptions = new IllustratorSaveOptions()

                                                      IllustratorSaveOptions.compatibility.ILLUSTRATOR15 //some of our printers have yet to upgrade

                                                      var onPO = Folder ('/Volumes/graphics/ •••Drafts•••/ • Draft Labels/ •On PO')

                                                      var saveFile = File(onPO + '/' + myLinkName);

                                                      myDoc.saveAs (saveFile, IllustratorSaveOptions)

                                                  }

                                   

                                   

                                              else alert ('Make note of the file with an error.')

                                              app.activeDocument.close (SaveOptions.DONOTSAVECHANGES)

                                   

                                   

                                              }

                                          }

                                      }

                                   

                                   

                                      else {

                                          // if user cancels action, display message

                                          alert("Rerun the script and choose a folder with label requests.");

                                      }

                                  }

                                   

                                   

                                  // run the script

                                  placeLabelRequests (getLabelRequests ());

                                  • 14. Re: Errors and more, my first illustrator script
                                    JoshK105 Level 1

                                    The case of things can make it tricky. Try the following bit instead.

                                     

                                                    var pdfOpts = app.preferences.pDFFileOptions

                                                    pdfOpts.pDFCropToBox = pDFBoxType.PDFBOUNDINGBOX;

                                    • 15. Re: Errors and more, my first illustrator script
                                      essejesse Level 1

                                      hmm, it throws the error, "pDFBoxType is undefined"

                                       

                                      I changed that one p to a P and then it instead says, "undefined is not an object." with four lines highlighted, but nothing selected. The first highlighted line is the second one of these:

                                                      var pdfOpts = app.preferences.pDFFileOptions

                                                      pdfOpts.pDFCropToBox = pDFBoxType.PDFBOUNDINGBOX;

                                       

                                       

                                      I changed the p in pDFCropToBox to a P and it didn't make any difference. Same result.

                                       

                                      So then I changed it back to exactly what you wrote and put pdfOpts in the placedItems.add() parentheses because I like to try putting things in there for some reason. That also made no difference.

                                      • 16. Re: Errors and more, my first illustrator script
                                        essejesse Level 1

                                        I worked around the place options for the PDF by adding in a function I found on this forum. It detects clipping masks and deletes them.

                                         

                                        There's one line in here that doesn't do anything, and I'm figuring out if it needs to be changed. After the clipScan function runs, I'm telling Illustrator to place a variable at a specific position, but because clipScan modifies the variable, it no longer recognizes that group of page items as the variable. Temporarily, I've used the original place position to make sure the link sits right where I want it to, but I have to make sure that the files we are provided never look any different.

                                         

                                        If they do, I'll need to asign a new variable and set the position after clipScan runs, I think. If it's necessary, I'll update with the fix, otherwise I think this is the final script.

                                         

                                            

                                        #target Illustrator

                                        app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

                                        function getLabelRequests() {

                                            return Folder.selectDialog('Please select the folder containing label requests:', Folder('~/Desktop'));

                                        }

                                         

                                         

                                        function placeLabelRequests(selectedFolder) {

                                            var myDoc;

                                         

                                         

                                            if (selectedFolder) {

                                                var fileRef = File("/Volumes/graphics/Standards/Job Forms/Label Job Form-5C.ai")

                                                var thisPlacedItem;

                                               

                                                // create document list from files in selected folder

                                                var fileList = selectedFolder.getFiles("*.pdf");

                                         

                                         

                                                for (var i = 0; i < fileList.length; i++) {

                                                    // open each document in file list

                                                    if (fileList[i] instanceof File) {

                                                        //open job form

                                                        open(fileRef);

                                                        myDoc = app.activeDocument;

                                         

                                         

                                                        // Place the label request on the artboard

                                                        thisPlacedItem = myDoc.layers['Job Form'].placedItems.add();

                                                        thisPlacedItem.file = fileList[i];

                                                        thisPlacedItem.position = [-50,10];

                                                        var myLinkName = myDoc.placedItems[0].file.name

                                                        thisPlacedItem.locked=true

                                                        thisPlacedItem.embed();

                                                        var clippingCount = 0

                                                        clipScan(myDoc)

                                                        thisPlacedItem.position = [15,-45];//this is the line that isn't doing anything right now.

                                         

                                         

                                                        redraw()               

                                                        //make sure the placed job form has the correct information

                                                        var proof = confirm ("Does the job form have the correct information?", true)//needs the redraw step above or nothing shows when the alert happens. Redraw forces Illustrator to display the actions performed so far.

                                                        if (proof) {

                                                            IllustratorSaveOptions = new IllustratorSaveOptions()

                                                            IllustratorSaveOptions.compatibility.ILLUSTRATOR15 //some of our printers have yet to upgrade

                                                            var onPO = Folder ('/Volumes/graphics/ •••Drafts•••/ • Draft Labels/ •On PO')

                                                            var saveFile = File(onPO + '/' + myLinkName);

                                                            myDoc.saveAs (saveFile, IllustratorSaveOptions)

                                                        }

                                         

                                         

                                                    else alert ('Make note of the file with an error. This file will not be saved.')

                                                    app.activeDocument.close (SaveOptions.DONOTSAVECHANGES)

                                         

                                         

                                                    }

                                                }

                                            }

                                         

                                         

                                            else {

                                                // if user cancels action, display message

                                                alert("Rerun the script and choose a folder with label requests.");

                                            }

                                        }

                                         

                                         

                                        // run the script

                                        placeLabelRequests (getLabelRequests ());

                                         

                                         

                                         

                                         

                                         

                                         

                                        //////////////////////////function to remove clipping paths from placed item, thanks to KennethWebb, Muppet Mark and CarlosCanto on the Adobe Illustrator Scripting forum.

                                         

                                         

                                        function clipScan (container) {

                                            for (i=container.pathItems.length-1;i>=0;i--) {

                                        var item = container.pathItems[i];

                                                if (item.clipping == true){ //screens for locked or hidden items (removed this after true:  && item.editable == true       so it no longer screens for locked or hidden items

                                                    container.pathItems[i].remove();

                                                    clippingCount++;

                                                }

                                            }

                                        };

                                        • 17. Re: Errors and more, my first illustrator script
                                          essejesse Level 1

                                          Of course they don't provide us files with some level of consistency, so I had to go in and asign a new variable and then place that in the right position.

                                           

                                          Final code:

                                           

                                          #target Illustrator

                                          app.userInteractionLevel = UserInteractionLevel.DONTDISPLAYALERTS;

                                          function getLabelRequests() {

                                              return Folder.selectDialog('Please select the folder containing label requests:', Folder('~/Desktop'));

                                          }

                                           

                                           

                                          function placeLabelRequests(selectedFolder) {

                                              var myDoc;

                                           

                                           

                                              if (selectedFolder) {

                                                  var fileRef = File("/Volumes/graphics/Standards/Job Forms/Label Job Form-5C.ai")

                                                  var thisPlacedItem;

                                                 

                                                  // create document list from files in selected folder

                                                  var fileList = selectedFolder.getFiles("*.pdf");

                                           

                                           

                                                  for (var i = 0; i < fileList.length; i++) {

                                                      // open each document in file list

                                                      if (fileList[i] instanceof File) {

                                                          //open job form

                                                          open(fileRef);

                                                          myDoc = app.activeDocument;

                                                          //remove placement text

                                                          myDoc.layers['Job Form'].groupItems[1].remove()

                                           

                                                          // Place the label request on the artboard

                                                          thisPlacedItem = myDoc.layers['Job Form'].placedItems.add();

                                                          thisPlacedItem.file = fileList[i];

                                                          thisPlacedItem.position = [0,0];

                                                          var myLinkName = myDoc.placedItems[0].file.name

                                                          thisPlacedItem.embed();

                                                          var clippingCount = 0

                                                          clipScan(myDoc)

                                                          var labelRequest = myDoc.layers['Job Form'].groupItems[0]

                                                          labelRequest.position = [15,-45];

                                                          labelRequest.locked=true

                                                          redraw()

                                           

                                                          //make sure the placed job form has the correct information

                                                          var proof = confirm ("Does the job form have the correct information?", true)//needs the redraw step above or nothing shows when the alert happens. Redraw forces Illustrator to display the actions performed so far.

                                                          if (proof) {

                                                              IllustratorSaveOptions = new IllustratorSaveOptions()

                                                              IllustratorSaveOptions.compatibility.ILLUSTRATOR15 //some of our printers have yet to upgrade

                                                              var onPO = Folder ('/Volumes/graphics/ •••Drafts•••/ • Draft Labels/ •On PO')

                                                              var saveFile = File(onPO + '/' + myLinkName);

                                                              myDoc.saveAs (saveFile, IllustratorSaveOptions)

                                                          }

                                           

                                           

                                                      else alert ('Make note of the file with an error. This file will not be saved.')

                                                      app.activeDocument.close (SaveOptions.DONOTSAVECHANGES)

                                           

                                                      }

                                                  }

                                              }

                                           

                                           

                                              else {

                                                  // if user cancels action, display message

                                                  alert("Rerun the script and choose a folder with label requests.");

                                              }

                                          }

                                           

                                           

                                          // run the script

                                          placeLabelRequests (getLabelRequests ());

                                           

                                           

                                          //////////////////////////function to remove clipping paths from placed item, thanks to KennethWebb, Muppet Mark and CarlosCanto on the Adobe Illustrator Scripting forum.

                                           

                                           

                                          function clipScan (container) {

                                              for (i=container.pathItems.length-1;i>=0;i--) {

                                          var item = container.pathItems[i];

                                                  if (item.clipping == true){ //screens for locked or hidden items (removed this after true:  && item.editable == true       so it no longer screens for locked or hidden items

                                                      container.pathItems[i].remove();

                                                      clippingCount++;

                                                  }

                                              }

                                          };