Using AppleScript to remove link boxes with no content
I wrote a code as follows, but I found that it was not executed well. The error message was always: "Adobe InDesign CC 2019" encountered an error: "graphic of item 1 of every page of document id 4" did not understand the "count" information.
Can anyone tell me where the problem is?
tell application "Adobe InDesign CC 2019"
set currentDoc to active document
repeat with currentPage in pages of currentDoc
repeat with currentGraphic in (every graphic of currentPage)
if (class of currentGraphic is image) then
set theLink to (link of currentGraphic)
if (theLink is missing value) or (status of theLink is link missing) then
delete currentGraphic
end if
end if
end repeat
end repeat
end tell
