几个小时,我试图编写脚本,这会自动将收到短信(iPhone>配对Mac)中的文字复制到剪贴板中。通过iMessages协议发送的消息运行良好,始终触发事件(接收消息,接收活动聊天消息,发送消息等)。但是在SMS(不是 iMessage)的情况下,有时会触发收到的消息 / on **活动聊天消息上的事件**。我甚至没有发现什么时候。
代码很简单,如下所示:
using terms from application "Messages"
on message received theMessage from theBuddy for theChat with eventDescription
say "received"
display notification "received"
end message received
on active chat message received with eventDescription
say "received active"
display notification "received active"
end active chat message received
on message sent theMessage for theChat
say "sent"
display notification "sent"
end message sent
# The following are unused but need to be defined to avoid an error
on chat room message received
# do nothing
end chat room message received
on addressed message received
# do nothing
end addressed message received
on received text invitation
# do nothing
end received text invitation
...
任何线索? Thanx很多!