Import Images Script tell application "InDesign CS" tell the active document set the rectangle_list to ¬ every rectangle of every spread whose label is not "" and ¬ content type is graphic type if the rectangle_list is {} then error "There are no tagged image rectangles." end if if the class of the rectangle_list is not list then set the rectangle_list to the rectangle_list as list end if end tell repeat with i from 1 to the count of the rectangle_list try set error_indicator to 1 set this_rectangle to item i of the rectangle_list set this_tag to the label of this_rectangle tell application "Expression Media" set this_image to ¬ (the path of first media item of the front window whose ¬ name begins with this_tag) select (first media item of the front window whose name begins with this_tag) end tell set error_indicator to 2 tell this_rectangle set this_image to place this_image if the class of this_image is list then set this_image to item 1 of this_image fit given content to frame set image_h to the horizontal scale of this_image set the image_v to the vertical scale of this_image if the image_v is greater than or equal to image_h then set horizontal scale of this_image to image_v else set the vertical scale of this_image to image_h end if fit given center content set color value of the fill color to {255, 255, 255} end tell on error error_message if the error_indicator is 1 then set the error_message to "Image “" & this_tag & ¬ "” could not be found in the database." end if activate beep display dialog error_message buttons {"Cancel", "Continue"} default button 2 end try end repeat end tell