3 Replies Latest reply on Apr 2, 2013 1:15 PM by ryan.marchese

    Can’t get spot "XXXX" - Applescript in Illustrator

    ryan.marchese Level 1

      I am trying to apply a swatch to a new rectangle using the script below, but for some reason I keep getting an error. I've tried changing to different swatches (some custom spots in the document, some PMS values) and all of them return the same error. Anyone have any ideas what I have missing? Using CS6.

       

       

      Script:

       

                   set pathRef to make new rectangle at layer 3 of document 1 ¬

                with properties {bounds:{0, 0, |width|, -|height|}, fill color:{class:no color info}, stroke color:{class:no color info}}

       

                   set ThroughCut to every page item of layer 3 of document 1

       

                   set stroke color of ThroughCut to {class:spot color info, tint:100, spot:spot "Through Cut"}

       

       

       

      Error:

       

           error "Adobe Illustrator got an error: Can’t get spot \"Through Cut\"." number -1728 from spot "Through Cut"

        • 1. Re: Can’t get spot "XXXX" - Applescript in Illustrator
          Muppet Mark Level 5

          I would suspect your issue is related to…

           

          set ThroughCut to every page item of layer 3 of document 1

           

          Surely this will return a list…?

           

          tell application "Adobe Illustrator"

                    tell the current document

                              set default filled to false

                              set default stroked to true

                              set x to make new layer

                              set y to make new rectangle at x with properties ¬

                                        {bounds:{0, 0, width as real, -height as real}}

                              set stroke color of y to {class:spot color info, tint:100, spot:spot "Cutter"}

                    end tell

          end tell

          • 2. Re: Can’t get spot "XXXX" - Applescript in Illustrator
            ryan.marchese Level 1

            I haven't been having any trouble with that part of the code, I have other lines (not posted) that make an empty layer and then add the above rectangle - so no list is returned.

             

            The problem is that none of my spots/swathces are being recognized under the "set" command. The document just keeps telling me that they aren't found.

            • 3. Re: Can’t get spot "XXXX" - Applescript in Illustrator
              ryan.marchese Level 1

              Also, I just tried your script and it wouldn't even save out. It is giving "expected X but found unknown token" errors throughout.