2 Replies Latest reply on May 9, 2012 10:29 AM by ax1e2l_b3r4a5s6s

    Applescript - trying to horizontally align all the text in a text frame

    ax1e2l_b3r4a5s6s Level 1

      I've tried the following snippet along with several others:

       

      tell application "Adobe InDesign CS5.5"

                tell the active document

                          set Text_Frame to the text frame "PH"

                          tell Text_Frame

                                    set theLines to every line

                                    if (theTextPos = "B") then

                                              tell theLines to set justification to left align

                                    else

                                              tell theLines to set justification to center align

                                    end if

                          end tell

                end tell

      end tell

       

      Throws errors about setting classes.

       

      ie

       

      error "Can’t set «class paln» of {\"MISSOULA COMMUNITY PHYSICIANS

      \", \"CENTER NO. 2

      \", \"CONDOMINIUM ASSOCIATION

      \", \"2827 FORT MISSOULA ROAD

      \", \"MISSOULA, MT 59804

      \", \"

      \", \"

      \"} to «constant mAOHcent»." number -10006 from «class paln» of {"MISSOULA COMMUNITY PHYSICIANS

      ", "CENTER NO. 2

      ", "CONDOMINIUM ASSOCIATION

      ", "2827 FORT MISSOULA ROAD

      ", "MISSOULA, MT 59804

      ", "

      ", "

      "}


       

      All I'm trying to do is center the text in a text frame if a condition is met, else left align it if another condition is met.

       

      Any suggestions woudl be appreciated.