5 Replies Latest reply on Oct 9, 2008 6:07 PM by (Daniel_Telfer)

    Enable clipping path

      I am trying to write a JS that will enable the clipping path (a Photoshop Path that will always be named 'Path 1') of a selected picture. Even though I'm a script retard, I imagined even this would be fairly easy to write but it isn't. All I'm trying to do is automate the chore of opening the Clipping Path dialog, changing the path type from 'None' to 'Photoshop Path', and clicking OK.

      I have read Adobe's scripting manuals, picked apart the samples, tried out the Wiki, and trawled the web and this forum. Is there a similar script out there that I could adapt? I would be grateful for suggestions - kind ones, please!

        • 1. Re: Enable clipping path
          [Jongware] Most Valuable Participant
          A quick search show that the property clippingType of ClippingPathSettings can be set to ClippingPathType.PHOTOSHOP_PATH. As possible parents for the ClippingPathSettings, I get the list EPS, Image, ImportedPage, PDF, PICT, and WMF -- I guess Image is the one for you.
          So that would come together as

          yourimage.clippingPath.clippingType = ClippingPathType.PHOTOSHOP_PATH

          Oh, wait -- you can have more than a single path in your PS image. Let's see. ClippingPathSettings also has a "appliedPathName" -- "The name of the Photoshop path or alpha channel to use as a clipping path." How do you know which paths it has? "photoshopPathNames"! ("Array of string; A list of the clipping paths stored in the graphic.")

          All of this while I'm not behind a CS3 machine and never having used this method :-) I guess that you skipped one step in your description, where ID would ask you
          i what
          path you want to use. If you are confident there's always a single path, you could do something like

          yourimage.clippingPath.appliedPathName = yourimage.clippingPath.photoshopPathNames[0];

          to select the first (and only) one in this array.

          Shameless plug alert. I could locate (and copy!) this information quickly without using the ESTK help, because I cheated and created an HTML version of the JS help, complete with hyperlinked cross-references and an index. You can download it from http://www.jongware.com/binaries/indesigncs3jshelp.zip if this sounds interesting.
          • 2. Re: Enable clipping path
            dabbsy Level 1
            Thank you, Jongware. Your help is greatly appreciated. I suspect my JavaScripting problems are more fundamental, though, as I'm trying to adapt coding from other scripts but don't understand the detail of JS construction.

            • 3. Re: Enable clipping path
              dabbsy Level 1
              Hello again. I missed this forum thread:

              The thread includes a ready-made JavaScript that does the job! Unfortunately, I was hoping to get a script that works on CS2 and CS3, and I now understand that InDesign CS2's scripting is broken with respect to clipping paths. Ho hum.

              Thanks for reading.

              • 4. Re: Enable clipping path
                Hi Alistair

                I think Kris at rorohiko.com does a plug-in that might help you.
                Try Products > Freebies > InDesign Plug-in Collection > ClipAThing
                • 5. Re: Enable clipping path
                  Can anyone get this to work in VB

                  this does not work
                  yourimage.clippingPath.clippingType = ClippingPathType.PHOTOSHOP_PATH

                  This works
                  yourimage.clippingPath.appliedPathName = ("Path 1")

                  but this does not either
                  yourimage.clippingPath.appliedPathName = yourimage.clippingPath.photoshopPathNames(1)

                  Can anyone help Iwant to use the path that is designated in photoshop or at least the first path in the array

                  Cheers Daniel