Get name of chat - error -1728

Hi

I am trying to make a AppleScript getting chat names from messages or ichat.

However, I keep getting error -1719 for the entire script and -1728 for the individual elements - how do I avoid that?

Script Debugger has full disk access - what is missing?

use AppleScript version "2.4" -- Yosemite (10.10) or later

use scripting additions

tell application id "com.apple.iChat" -- Messages
	tell its chat 1
		name
	end tell
end tell

Screenshot 2020-06-25 at 12.23.36

The issue is with Messages.app itself. I wouldn’t be surprised if it’s a deliberate change in the name of security.

Okay - can I change any thing to help the process?

No, unfortunately. Messages scripting looks like something that is going away.

This seems to have been fixed in Monterey but something else has been broken – attaching files to messages doesn’t work via AppleScript anymore.