script to delete all items on the pasteboard

Thanks Yvan, I tried using “where” instead of “whose”, I even tried:


set ThePasteboard to (get page items where its parent page is nothing)

but it didn’t make any difference.

By the way, the AppleScript you provided results in a list of parent pages, some members of which are nothing. So Indesign can see them but just can’t list them like we would expect. Indesign supports AppleScript very well and can handle “whose”, as demonstrated in the code above that is part of my workaround:


set ThePageArea to every page item whose class of parent page is page

This is why I think it’s just a bug, limitation or oversight in Indesign’s AppleScript support. But we often find these in our travels! The workaround works fine for now.

It also applies for parent page. If you ask for the parent page of an item on the pasteboard, it returns nothing.

(A little bit of AppleScript history: In the beginning, AS had no missing value class, or way of representing nil. InDesign defined its own nothing property at that time. The missing value class came along later.)

Except it isn’t, unfortunately.

So, whose does not work with this nothing. But then why does the following work? Maybe someone met a similar case, and will share with us.


set thePasterboard to {}
tell application "Adobe InDesign 2020" to tell document 1 to tell spread 1
	repeat with pageItem in (page items)
		if parent page of pageItem is nothing then set end of thePasterboard to contents of pageItem
	end repeat
end tell

That’s the $64 question. It looks like a bug.