Hi
What I am trying to do is access a tagged rectangle called IMAGE, with a script label of IMAGE in a group on a locked layer, and replace that rectangles content with a new image, and have not had much success.
When I unlock the layer and un-group the group, I can then access the tagged rectangle¨with the code below.¨(the code was cobbled together from here http://www.macosxautomation.com/applescript/datapublish/index.html)
Could someone please show me how to reference a tagged rectangle on a locked layer in a group please, if I need to unlock the layer then that’s fine.
tell application "Adobe InDesign CS4"
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
set this_image to "PATH TO IMAGE" as alias --testing
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
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
cheers