Reply To: On the Move to InDesign: Formatting Text

Home Page / Forums / On the Move to InDesign: Formatting Text / Reply To: On the Move to InDesign: Formatting Text

#14323401
Jeremy Howard
Participant

Here is that same script without the comments on every line (just in case you find it less confusing).

(*======================== BEGIN SCRIPT ==============================*)
tell application id “com.adobe.indesign”
repeat 1 times

if (count of documents) = 0 then
display dialog “Please open a document and try again.”
exit repeat
end if

set myDoc to active document
set myPageItems to every page item of myDoc
set imageFrameArray to {}

tell myDoc to ungroup every group

try
set myDestLayer to layer “Images” of myDoc
on error
tell myDoc to set myDestLayer to make layer with properties {name:”Images”}
end try

repeat with i from 1 to length of myPageItems
set aFrame to item i of myPageItems

if class of aFrame = group then
set myGroupFrames to every page item of aFrame
repeat with g from 1 to length of myGroupFrames
set gFrame to item g of myGroupFrames

if class of gFrame = rectangle or class of gFrame = polygon or class of gFrame = oval then
copy gFrame to the end of imageFrameArray
end if
end repeat
else if class of aFrame = rectangle or class of aFrame = polygon or class of aFrame = oval then
copy aFrame to the end of imageFrameArray
end if
end repeat

repeat with x from 1 to length of imageFrameArray
set thisFrame to item x of imageFrameArray

try
set myLinkedItem to page item 1 of thisFrame
set myLinkName to name of item link of myLinkedItem
set item layer of thisFrame to myDestLayer
end try

end repeat

display dialog “Finished.”

end repeat
end tell
(*======================== END SCRIPT ==============================*)

This article was last modified on December 21, 2019

Comments (0)

Loading comments...