2 Replies Latest reply on Jun 19, 2008 12:57 PM by Kevin Parrott

    [AS] Change Colour of  all page items on layer

    Kevin Parrott Level 2
      Hi

      I am trying to set up a script to change the colour of fill, stroke and text of page items on one layer, and having very little luck, what I have so far is below, as it stands I seem to only be creating the swatch, could I get a few pointers on how to do this correctly please?
      I have three attempts as below, which return pretty much the same result, nothing?

      (1)

      tell application "Adobe InDesign CS3"
      set myDocument to active document
      activate
      tell document 1
      try
      set _Swatch to make color with properties {name:"PANTONE Blue 072 U", color:spot, color value:{100, 88, 0, 5}, model:spot}
      set _NewColour to swatch "PANTONE Blue 072 U"
      set swatch _NewColour to every page item whose fill color is swatch "Black"
      set swatch _NewColour to every page item whose stroke color is swatch "Black"
      end try
      end tell
      end tell

      (2)

      tell application "Adobe InDesign CS3"
      set myDocument to active document
      activate
      tell document 1
      try
      set _Swatch to make color with properties {name:"PANTONE Blue 072 U", color:spot, color value:{100, 88, 0, 5}, model:spot}
      set _NewColour to swatch "PANTONE Blue 072 U"
      set _Colour to swatch "Black"

      set _Fill to every page item whose fill color is swatch "Black"
      set _Fill to _NewColour

      set _Stroked to every page item whose stroke color is swatch "Black"
      set _Stroked to _NewColour
      end try
      end tell
      end tell

      (3)

      tell application "Adobe InDesign CS3"
      set myDocument to active document
      activate
      tell document 1
      try
      set _Swatch to make color with properties {name:"PANTONE Blue 072 U", color:spot, color value:{100, 88, 0, 5}, model:spot}
      set _NewColour to swatch "PANTONE Blue 072 U"
      set _Colour to swatch "Black"
      set _Fill to every page item whose fill color is swatch "Black"
      set _Stroked to every page item whose stroke color is swatch "Black"
      set _All to _Fill & _Stroked
      set swatch of _All to swatch _NewColour
      end try
      end tell
      end tell

      Cheers
      Kev
        • 1. [AS] Change Colour of all page items on layer
          sstanleyau Level 4
          Try this:<br /><br />tell application "Adobe InDesign CS3"<br />    set myDocument to active document<br />    activate<br />    tell document 1<br />        try<br />            set theLayer to layer 1 -- or whatever<br />            set _Swatch to make color with properties {name:"PANTONE Blue<br />072 U", color:spot, color value:{100, 88, 0, 5}, model:spot}<br />            set _Colour to swatch "Black"<br />            set fill color of every item of all page items whose fill color<br />is _Colour and item layer is theLayer to _Swatch<br />            set stroke color of every item of all page items whose stroke<br />color is _Colour and item layer is theLayer to _Swatch<br />        end try<br />    end tell<br />end tell<br /><br />-- <br />Shane Stanley <sstanley@myriad-com.com.au>
          • 2. Re: [AS] Change Colour of  all page items on layer
            Kevin Parrott Level 2
            Thankyou Shane, perfect.

            I wasn't to far of, but far enough to not be right ;)

            Appreciate your help

            Kev