I've been doing some searching around online for an answer to this question and can't seem to find one. My aim is to run a bash script which waits for the arrival of an iMessage from a specific contact and when the message is received, it inputs the content of the iMessage into a specified command.
I understand that whatever the command is (if there is one) to check for the presence of a new message from a specified contact will probably have to be repeated in some sort of loop but for now, I am just wondering if there is some sort of command (maybe osascript) which can check for this?
iMessage: From, Tom: Hello World
echo "$imessagemessage" > ~/Desktop/message.txt
Does anyone know if this is possible? If so, I would really appreciate it if someone could give me some guidance.
Thank you in advance,