6 Replies Latest reply on May 12, 2018 3:29 AM by uniqued_tol

    convert to shape

    uniqued_tol Level 2

      Hi scripters;

      exam.jpg

       

      I have a lot of objects. I need to change it as follows. (Provided that the contents remain the same;)

      I would be glad if you can help

        • 1. Re: convert to shape
          S Hopkins Adobe Community Professional

          Not too sure what you are looking for here. The convert shape command converts a single item to a different shape. (1) Can be used to convert text frame to a spline item such as rectangle, oval, polygon. (2) Can be used to convert page items (rectangles, spline items, imported page, media items, groups, etc.) to another shape (convert a closed path to an open path, convert rectangle to a rounded rectangle, etc.). Your diagram would indicate combining two items into one as with a group or perhaps embedding one item inside another. Please explain.

          • 2. Re: convert to shape
            uniqued_tol Level 2

            Okay, explain more simply

             

            exam.jpg

            • 3. Re: convert to shape
              S Hopkins Adobe Community Professional

              Hi,

              Sorry about the delay. I think I know what you are looking for now. What you need to do is define a path for the new shape. This takes a little calculation.  The shape created by the following is not exactly yours, but I think you can figure it out from there.

              --select item to modify before running script

              set numPts to 4

              tell application "Adobe InDesign CC 2018"

                set measurement unit of script preferences to points

                set x to item 1 of selection

                set gBounds to geometric bounds of x

                set bhgt to (item 3 of gBounds) - (item 1 of gBounds) --calculate box height

                set bf to bhgt / (numPts * 2) --

                set z to entire path of path 1 of x --path points of original rectangle

                set bx0 to item 1 of item 3 of z --bottom right x point of original

                set by0 to item 2 of item 3 of z--bottom right y point of original

                set edgePts to {{bx0, by0}} --set up list for points on right edge

                repeat with i from 1 to numPts

                set by0 to (by0 - bf)

                set thisPt to {bx0 - bf, by0}

                set end of edgePts to thisPt

                set by0 to (by0 - bf)

                set nxtPt to {bx0, by0}

                set end of edgePts to nxtPt

                end repeat

                set newPath to {item 1 of z, item 2 of z} & edgePts --define the path points

                tell x

                set entire path of path 1 to newPath --create the new shape

                end tell

              end tell

              1 person found this helpful
              • 4. Re: convert to shape
                Michel [FRIdNGE] Level 3

                Just For Fun … But Not For Free!

                 

                "Tatoo" is the last script I wrote!

                 

                Capture d’écran 2018-05-12 à 01.34.25.png

                 

                The user just selects the "pattern" [s]he created [what [s]he wants! ] and the similar objects [s]he wants to be tattooed! …

                [I'll write later a "batch"version with UI.]

                 

                Capture d’écran 2018-05-12 à 01.35.08.png

                 

                … and [s]he plays "Tatoo"!

                 

                Capture d’écran 2018-05-12 à 01.35.45.png

                 

                Even if Tatoo has a global undo, if the user is not satisfied by the result, [s]he can modify the pattern or choose another one:

                 

                Capture d’écran 2018-05-12 à 01.36.18.png

                 

                … and "Tatoo" again!

                 

                Capture d’écran 2018-05-12 à 01.36.34.png

                 

                Of course, "Tatoo" loves simple shapes, ID effects and object styles! …

                 

                Capture d’écran 2018-05-12 à 01.57.56.png

                 

                Best,

                Michel, from FRIdNGE

                2 people found this helpful
                • 5. Re: convert to shape
                  uniqued_tol Level 2

                  I don't know and do not use [as] @S Hopkins.

                  thank you...

                  • 6. Re: convert to shape
                    uniqued_tol Level 2

                    @Michel [FRIdNGE] that's exactly what I want! great job.