Remove missing links in Illustrator?

I’m thinking of writing a script to remove bitmaps in an illustrator file that are placed as a linked object (placed items) and have lost their connection to the original file because the original file has been moved.

Is there a way to identify broken links? It seems like such an obvious thing, but I can’t see a way to do it.

I would expect the file path to go from string to missing value although I have not tested this.

Ah yes, you’re right. Thanks for pointing me in the right direction.

Of course, it doesn’t quite work in the way you might expect.

This will give you an error:

set myFilePath to file path of placed item 1

But this will work fine:

set myProperties to properties of placed item 1-- returns a record with all the properties of "placed item 1"
set myContentVar to file path of myProperties -- extracts the file path from the record
if myContentVar is missing value then beep