AppleScript InDesign CS 2


Indesign CS 2 | Indesign CS 1 | Indesign ver. 2 | Miscellaneous |




Index






Center objects in selection June 23, 2006
tell application "Adobe InDesign CS2"
   
-- Pick the bounds of a page: the top, the left, the bottom and the right.
   set {b, a, d, c} to bounds of page 1 of document 1

   set mySelection to selection

   set myDoc to active document

   tell myDoc
      -- If mySelection contain much than one item, I group them
      if (count of mySelection) > 1 then
         set myItem to make group with properties {group items:(mySelection)}
      
else
         set myItem to item 1 of selection
      end if

      
-- Pick the bounds of the group.
      set {y1, x1, y2, x2} to geometric bounds of myItem

      move myItem to {(c - x2 + x1) / 2, (d - y2 + y1) / 2}

      if (count of mySelection) > 1 then
         ungroup myItem
      end if
   end tell
end tell

Top | back to top of this page




List of JPG June 23, 2006
tell application "Adobe InDesign CS2"
   
set myWindow to active window
   set mydoc to active document
   
   
tell mydoc
      set ListOfJPG to every link whose link type = "JPEG"

      
if (count of ListOfJPG) = 0 then
         display dialog "No jpg in this document" buttons "OK" default button 1
      
else
         set myObj to parent of parent of item 1 of ListOfJPG
         select myObj
         set active spread of myWindow to parent of parent of myObj
         tell myWindow
            set zoom percentage to 200
         
end tell
      end if
   end tell
end tell

Top | back to top of this page




List image overflow June 23, 2006
tell application "Adobe InDesign CS2"
   tell active document
      set toSmallPPI to every item of all graphics where item 1 of effective ppi < 280
      set toBigPPI to every item of all graphics where item 1 of effective ppi > 320
   
end tell
end tell

Top | back to top of this page




Create Layer June 23, 2006
set TheReference to "This is the Reference"
tell application "Adobe InDesign CS2"
   
set LayerName to "New Layer"
   
tell document 1
      
-- Is this layer is exist ?
      try
         
set myLayer to layer LayerName
         
-- No? -> create it
      on error
         
set myLayer to make layer with properties {name:LayerName}
      
end try

      
tell page 1
         
set TheReferenceFrame to make text frame with properties {geometric bounds:{"5.0", "5.0", "15.0", "100.0"} ¬
            ,
rotation angle:0, contents:TheReference, item layer:myLayer}
      
end tell
   end tell
end tell




Top | back to top of this page





Last updated June 23, 2006


Valid HTML 4.01!