4 Replies Latest reply on Nov 5, 2010 1:34 PM by joesickspack

    Applescript: Indesign CS4 Set Text Wrap with Alpha Channel?

    joesickspack Level 1

      Is it possible to set an object's text wrap properties with Applescript?

       

      I want to set these wrap properties:

       

      Wrap type: Wrap around object shape

      Offset: .1"

      Wrap to: Both left & right sides

      Contour type: Alpha Channel

      Alpha Channel Name: "MyAlpha"

      Include inside edges: False

       

      I want to set the same wrap properties for every graphic in a file, so I was hoping to do something like this:

       

      tell application "Adobe InDesign CS4"

      activate

      tell active document

      repeat with thisGraphic in all graphics of every page

      try

      set (properties of thisGraphic) to {WHAT GOES HERE?}

      end try

      end repeat

      end tell

      end tell

        • 1. Re: Applescript: Indesign CS4 Set Text Wrap with Alpha Channel?
          Muppet Mark-QAl63s Level 4

          I did not have much time to test this (supposed to be working!!!) but it should be pretty close…

           

          tell application "Adobe InDesign CS2"

          tell the active document

          set ag to all graphics

          repeat with gi in ag

          if alpha channel path names of contour options of text wrap preferences of gi contains "MyAlpha" then

          set text wrap type of text wrap preferences of gi to contour

          set text wrap offset of text wrap preferences of gi to 1

          set inverse of text wrap preferences of gi to false

          set contour type of contour options of text wrap preferences of gi to alpha channel

          set contour path name of contour options of text wrap preferences of gi to "MyAlpha"

          set include inside edges of contour options of text wrap preferences of gi to false

          end if

          end repeat

          end tell

          end tell

           

          It should ONLY apply text wrap to graphics that have an Alpha Channel with your quoted name. You may have to deal with your units prefs for the offfset thou…

          • 2. Re: Applescript: Indesign CS4 Set Text Wrap with Alpha Channel?
            joesickspack Level 1

            Thank you. That worked great with two minor changes:

             

            This line:

            set contour path name of contour options of text wrap preferences of gi to "MyAlpha"

            causes this error:

            "Adobe InDesign CS4 got an error: The property is not applicable in the current state."

            so I added try . . . end try.

             

            And for CS4 "text wrap style" has to be changed to "text wrap mode"

             

            So here's what works:

             

            tell application "Adobe InDesign CS4"

            tell the active document

            set ag to all graphics

            repeat with gi in ag

            try

            if alpha channel path names of contour options of text wrap preferences of gi contains "MyAlpha" then

            set text wrap mode of text wrap preferences of gi to contour

            set text wrap offset of text wrap preferences of gi to .1

            set inverse of text wrap preferences of gi to false

            set contour type of contour options of text wrap preferences of gi to alpha channel

            set contour path name of contour options of text wrap preferences of gi to "MyAlpha"

            set include inside edges of contour options of text wrap preferences of gi to false

            end if

            end try

            end repeat

            end tell

            end tell

             

             

            • 3. Re: Applescript: Indesign CS4 Set Text Wrap with Alpha Channel?
              Muppet Mark-QAl63s Level 4

              After posting my reply I happened to notice the same thing. It would appear that it does NOT like setting the contour path name to something it already is so I wrapped just that one line in an if statement… Glad you have it working anyhow… Oh my text appears to have gone all friday mad!!!?

               

              • 4. Re: Applescript: Indesign CS4 Set Text Wrap with Alpha Channel?
                joesickspack Level 1

                Yeah, wrapping the one line makes more sense.

                 

                The forum bolding is all haywire. Plus, I've never been able to get the indenting to work.