10 Replies Latest reply on Jan 29, 2017 4:11 AM by Laubender

    Is there a quick way to find out if a PageItem has image?


      Hi folks,


      Something that bothers me for quite some is when I have a collection of say PageItems and I want to for example resize the image that a PageItem may contain, do I really need to check first if that PageItem is a rectangle? Since "textFrames[i].images[0]" isn't allowed, I always have to make an extra if-statement:


      myPageItems = app.activeDocument.allPageItems;

      if (myPageItems[i] instanceof Rectangle)


           if (myPageItems[i].images.length == 1)


                further code


      Is there a way how to check if the PageItem holds an image without verifying the PageItem first? I know that I can just check for images and use images[0].parent to get to the Rectangle, but I feel that I'm not knowing a very basic method of checking the right way.