0 Replies Latest reply on Jun 13, 2011 9:57 AM by davidpeterwilliams

    how do I locate column/row (number) selected in applescript

    davidpeterwilliams

      I require a simple script to adjust the column widths of the current selected column only. I want to base it on a script below which I found on the internet. This script adjusts multiple column widths to the value input and adjusts the stub column to the remaining space. I would like to know how easy it is to create a script with a similar input window that adjusts the column/row selected leaving the others in tact.

       

       

      tell application "Adobe InDesign CS4"
          activate
          if class of parent of selection is not cell then
              display dialog " Do not highlight any cells " buttons " OK " default button 1 with icon caution
          else
              set monTableau to parent of parent of selection
              set NbColonnes to count columns of monTableau
              set monBlocTexte to parent text frames of selection
              set maBoiteTexte to item 1 of monBlocTexte
              set {y, x, h, l} to geometric bounds of maBoiteTexte
              set largeurBloc to (l - x)
              tell text frame preferences of maBoiteTexte
                  set NumColTexte to text column count
                  set largGout to text column gutter
              end tell
              display dialog "Width of columns (mm) " default answer 20
              set largeurTexte to text returned of the result
              set largcol2 to (largeurTexte as integer)
              set largcol1 to ((largeurBloc - (NumColTexte - 1) * largGout) / NumColTexte - (NbColonnes - 1) * largcol2)
              if largcol1 < 2 then
                  set largcol1 to ((largeurBloc - (NumColTexte - 1) * largGout) / NumColTexte) / NbColonnes
                  set largcol2 to ((largeurBloc - (NumColTexte - 1) * largGout) / NumColTexte) / NbColonnes
              end if
              set width of column (1) of monTableau to largcol1
              repeat with counter from 2 to NbColonnes
                  set width of column (counter) of monTableau to largcol2
              end repeat
          end if
      end tell

       

       

       

      Your help will be greatly appreciated

       

      Thanks

       

      Dave Williams