Skip navigation
Currently Being Moderated

Applescript that turns ON all Clipping Paths in InDesign CS3 document

Jul 9, 2008 8:48 AM

Hello All

I've been trying for a day or 2 now to find some script (that will work without problems) that turns on ALL the clipping paths in an InDesign document.

I've went with Applescript just because a few of us in the office know just a bit more about then our complete lack of knowledge with javascript.

We're needing to turn on ALL the clipping paths on ALL the graphics (objects, images...whatever they're called) in the document. We are wanting the Photoshop Path used and for it to use a specific path (for instance, only use path named "Path 1").

Since I am completely script-writing retarded...I was wondering if anyone knows anything about writing this particular script or if someone could shoot me in the right direction.

Thanks so much!
 
Replies
  • Currently Being Moderated
    Jul 9, 2008 6:53 PM   in reply to (Cara_Brooke_Adams)
    You want something like this (untested):<br /><br />tell application "Adobe InDesign CS3"<br />    tell document 1<br />        set properties of all graphics whose class is image to {clipping<br />path:{applied path name:"Path 1", clipping type:photoshop path}}<br />    end tell<br />end tell<br /><br />But it may run into problems if there are pics with no such path.<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au>
     
    |
    Mark as:
  • Currently Being Moderated
    Aug 11, 2008 12:59 PM   in reply to (Cara_Brooke_Adams)
    I am looking for a script to do the exact opposite. We have a large catalog which has been converted from Quark and we need to quickly turn off all the clipping paths. Do you know of any?
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 7, 2008 12:42 PM   in reply to (Cara_Brooke_Adams)
    Does anyone have an update to this question of turning the paths off in Indesign?
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 7, 2008 5:10 PM   in reply to (Cara_Brooke_Adams)
    Maybe something like this? I haven't tested thoroughly, but it should turn off every clipping in the document I think...

    tell application "Adobe InDesign CS2"
    tell active document
    repeat with thisGraphic in all graphics of every page
    set clipping type of clipping path of thisGraphic to none
    end repeat
    end tell
    end tell
     
    |
    Mark as:
  • Currently Being Moderated
    Apr 2, 2009 6:39 AM   in reply to (Cara_Brooke_Adams)
    The script to turn off the clipping paths works great. -Thanks

    I get an error when trying to run the script to turn the clipping paths on.

    Adobe InDesign CS3 got an error: Invalid value for set property 'clipping type'. Expected none/detect edges/alpha channel/photoshop path/user modified path, but received (=>("clippingpath", (clipping type=>photoshop path,applied path name=>"Path 1"))).

    Running InDesign CS3 version 5.0.4
     
    |
    Mark as:
  • Currently Being Moderated
    Oct 15, 2010 6:13 PM   in reply to (jasonbak)

    This works in CS4:

     

     

    tell application "Adobe InDesign CS4"

    tell active document

    repeat with thisGraphic in all graphics of every page

    try

    set (properties of thisGraphic) to {clipping path:{clipping type:detect edges, inset frame:-0.5, restrict to frame:true, threshold:1, tolerance:0, use high resolution image:true}}

    end try

    end repeat

    end tell

    end tell

     

     

    For Photoshop path substitute in this line:

     

    set (properties of thisGraphic) to {clipping type:photoshop path, clipping path:{applied path name:"Path 1"}}

     

    For other properties see:

    CS3: http://www.indesignscriptingreference.com/CS3/AppleScript/clipping-pat h-settings.htm

    CS4: http://www.indesignscriptingreference.com/CS4/AppleScript/clipping-pat h-settings.htm

     
    |
    Mark as:
  • Currently Being Moderated
    Feb 7, 2012 8:16 AM   in reply to Eric @ MCA

    Eric @ MCA wrote:

     

    Maybe something like this? I haven't tested thoroughly, but it should turn off every clipping in the document I think...

    tell application "Adobe InDesign CS2"
    tell active document
    repeat with thisGraphic in all graphics of every page
    set clipping type of clipping path of thisGraphic to none
    end repeat
    end tell
    end tell

    Brilliant, thank you for posting that Eric.

     

    Can anyone translate this to JavaScript? I'm attempting to learn and I find like for like examples help hugely.

     

    Apologies for resurrecting an old thread, just noticed the date, sorry.

     
    |
    Mark as:
  • John Hawkinson
    5,572 posts
    Jun 25, 2009
    Currently Being Moderated
    Feb 8, 2012 7:42 PM   in reply to Andrew Kinnear
    var
      i, j, allGraphics,
      allGraphicsArrays = app.activeDocument.pages.everyItem().allGraphics;
     
    for (i=0; i<allGraphicsArrays.length; i++) {
      allGraphics = allGraphicsArrays[i];
      for (j=0; j<allGraphics.length; j++) {
        allGraphics[j].clippingPath.clippingType = ClippingPathType.NONE;
      }
    }
    
     
    |
    Mark as:
  • Currently Being Moderated
    Feb 9, 2012 2:06 AM   in reply to John Hawkinson

    Thank you very much for taking the time to do that John, that's extremely helpful and working perfectly.

     

    Andrew

     
    |
    Mark as:
  • Currently Being Moderated
    Oct 9, 2012 6:05 PM   in reply to Andrew Kinnear

    Was/ is anyone able to create a .jsx script to turn "all" paths on in a document?

     

    I work in designing and laying out catalogs and this would save a ton of time. Thanks again!

     

    Gabe

     
    |
    Mark as:

More Like This

  • Retrieving data ...

Bookmarked By (0)