Tuesday, July 17, 2018

#1 2018-01-03 11:47:27 am

hc98br
Member
From:: Leicester, England
Registered: 2004-05-21
Posts: 5
Website

Reading iMessages

Hi,

I'm trying to write a script that will go through all the chats in the Messages app - my goal is to find all messages I haven't replied to and send me an reminder.

But I'm stuck at square one - I can see how many message I have:

Applescript:

tell application "Messages" to log (count of chats)

But I can't get even simple properties out of a chat; for example:

Applescript:

tell application "Messages" to set x to started of first chat

gives the error: Can’t get started of chat 1." number -1728 from started of chat 1

Any ideas where I'm going wrong...?

Many thanks.

Ben


Filed under: messages chats

Offline

 

#2 2018-01-04 11:04:46 am

hc98br
Member
From:: Leicester, England
Registered: 2004-05-21
Posts: 5
Website

Re: Reading iMessages

I've decided to give up on this and go directly to the database with a shell script.

If it helps anyone, I think this will do the job:

sqlite3 -line ~/Library/Messages/chat.db "SELECT m.ROWID, text, MAX(date) lastMessageDate, is_from_me, h.id FROM message m INNER JOIN handle h ON h.ROWID=m.handle_id GROUP BY h.ROWID"

Offline

 

Board footer

Powered by FluxBB

RSS (new topics) RSS (active topics)