How Do I Get Properties of Chat?

###How Do I Get Properties of Chat?
Running Messages 9.2 (5100) on macOS 10.11.4

No matter what I try, the chat properties are always unavailable:

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

tell application "Messages"
  set oChat to first text chat
  set propList to properties of oChat
end tell

No properties are avaiable for any chat item.

Any Ideas?

My guess is that it’s now considered unacceptable on security grounds. Log a bug and you will probably find out.

Thanks, but that’s really dumb, isn’t it?
If I, as the user, can open the Messages app and view all of the Chat info, why would there be a security risk for doing exactly the same using AppleScript?

Also dumb, is that I can setup an AppleScript to trap new incoming Chats, and get all the info I want. What makes one be a security risk but not the other???

Waste of time, like p*ssing in the wind. :wink:

I’m just speculating. There are plenty of things a user can do that are not allowed via AppleScript.

Not at all. If you get a response along the lines of “Works as expected”, you know it’s deliberate. And if it is a security issue, chances are that’s what will happen.

I Tried to run Jim’s script, and while it was running a dialog appeared in Script Debugger, something about an

“Object Spcifier”

(I tried to take a screen shot but wasn’t quick enough. I’ve got a feeling that typo in the dialog is generated by SD)

Is that enough to track it down?

I’m not sure what you’re asking, Ed.

It is not a SD issue.
I’ve tried many different ways to trying to get the chat properties.

for example:

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

tell application "Messages"
  set chatList to every text chat
end tell

Yields this:

It’s a typo in the SD user interface. Sometimes when I run your script I get a alert dialog with progress that says:

“Validating Object Spcifier”

I’m hoping Shane/Mark will be able to correct the typo in the alert/progress/dialog

This looks like a dead end. Although lots of information should be in the chat properties (according to the object model), the explorer shows nothing of any value.

Yes, that’s good – thanks.

Hey JM,

Old news.

Nothing fixed in Sierra either (that I can see).


Script Debugger’s explorer is doing this because when it tries to determine the type of object instance it is dealing with it is receiving an incorrect object type (cobj - item instead of the correct ictt - text chat) from Messages.

If you try and read a text chat property directly in AppleScript:

tell application "Messages"
	active of text chat id "iMessage;-;+12509999999"
end tell

You get an error back: Messages got an error: Can’t get active of text chat id "iMessage;-;+12509999999". I can only conclude that this is a Messages bug. The only thing I can suggest is file a bug with Apple and hope that someone cares enough to resolve the problem.

Thanks for the info Mark.
Where do we file a bug with Apple?
Will it help if more than one of us files the same bug?

You need to get yourself a free account, and file a bug through Bug Reporter. Think of each bug report as a vote: the more there are the more likely someone is to notice the issue.

Came across this thread. Trying to achieve the same thing, and have the same error still.

messages = Application('Messages')
list = messages.chats()[0].id()

Return “Error -1728: Can’t get object.”

I filed a bug report with Apple, so let’s see what they say.