0 Replies Latest reply on Aug 2, 2011 1:10 AM by OlivierBerquin

    [AS] Need some advice about baseline

    OlivierBerquin Level 1

      I'm tired of "cuts" such that it:

      With an annual global production of roughly 5,000

      GW, it forms a fundamental component of […]

       

      You see that the 5,000 is not on the same line as the GW.

       

      So, I wrote a script whose

      - find a digit, a space, a character

      - in a different baseline.

       

      I wrote this, but is not very fast…

       

      So, I wonder if it is not possible to find a solution with a "whose"… Something like:

       

                set theSequences to (object reference of every item of theFind where baseline of character 1 is not baseline of character -1)


      set theList to {}

      set myText to ""

      set thebounds to {0, 0, 150, 150}

       

      tell application "Adobe InDesign CS5.5"

           set myDocument to active document

           set myWindow to active window

       

           set find grep preferences to nothing

           set position of find grep preferences to normal

       

           set find what of find grep preferences to "\\d+ ."

       

       

           tell myDocument

                set theFind to find grep

           end tell

       

       

           set find grep preferences to nothing

       

       

           repeat with aSequence in theFind

                tell aSequence

                     try

                          if baseline of character 1 is not baseline of character -1 then

                               set Pagenumber to the name of parent page of parent text frames of aSequence

                               set myParentPage to parent page of parent text frames of aSequence

                               set end of theList to "page: " & Pagenumber & " | " & aSequence & return

                          end if

                     end try

                end tell

           end repeat

       

       

       

           set myText to every item of theList as Unicode text

       

           set theBlack to swatch "Black" of myDocument

           tell page 1 of myDocument

                set theFrame to make text frame with properties {geometric bounds:thebounds, contents:myText, fill color:theBlack, fill tint:20}

                -- This is a detail

                tell text frame preferences of theFrame

                     set text column count to 3

                     set text column gutter to 3

                end tell

           end tell

       

       

           -- zoom on the page

           select theFrame

       

           tell myWindow to zoom given fit page

       

      end tell

       

       

       

       

       

      TIA.