After upgrading to Monterey i can't send image files thru Messages.app using AppleScript. The script below worked before I upgraded to Monterey. I think it's some sort of privileges/sandbox bug and Messages.app can't access and send a file. Any solutions to the problem?
on run tell application "Messages" set targetService to 1st account whose service type = iMessage set targetBuddy to participant "MyPhoneNumber" of targetService send POSIX file "/Users/MyUserName/Desktop/example.jpg" to targetBuddy #send "hello" to targetBuddy #sending text messages works, sending image files no longer works end tell end run