0 Replies Latest reply on Jul 10, 2017 12:34 PM by luizdsilveira

    Check if objects are smaller than 1mm

    luizdsilveira

      Hi.

       

      I have a very common and boring task here: check in a file full of text for all characters smaller than 1mm hight (need it before sending some package design to print due to local regulation). To make it easier I assembled the script below, but the problem is when texts are converted to outline, the script will check even the holes inside the characters, and will count them if they are smaller than 1mm.

       

      I've tried to maybe select a word and Pathfinder / Unit it, to make sure all holes will me merged, but didn't find a way.

       

      Does someone has a better idea?

       

      Thanks,

      Luiz

       

       

      tell application "Adobe Illustrator"

        tell document 1

        set layers's visible to false

       

      -- Select all text and put in a new layer

      make layer with properties {name:"1_LayerTextosMenores"

        set myText to every text frame

        duplicate myText to layer "1_LayerTextosMenores"

       

      -- Convert those texts to Outlines.

        tell layer "1_LayerTextosMenores"

        repeat with x from (count every text frame) to 1 by -1

        tell text frame x

        try

        convert to paths

        end try

        end tell

        end repeat

        end tell

       

       

      -- make all Stroked part of the text, to avoid it to not be counted in height

        tell application "Adobe Illustrator"

        activate

        tell application "System Events" to keystroke "a" using command down

        tell application "System Events" to keystroke "g" using command down & shift down

        tell application "System Events"

        click menu item "Outline Stroke" of menu "Path" of menu item "Path" of menu "Object" of menu bar item "Object" of menu bar 1 of process "Adobe Illustrator"

        end tell

       

        end tell

       

      -- create layer to put all text that it's not important to me: bigger than 1mm

       

        make layer with properties {name:"2_LayerTextosMaiores"}

       

        set Tcount to count of every path item

        repeat with i from 1 to Tcount

       

        set CH to the (height of path item i) / 28.3439902

       

        if CH > 0.1 then

        try

        move path item i to layer "2_LayerTextosMaiores"

        end try

       

       

        end if

        end repeat

        end tell

      end tell