简体   繁体   中英

Send group iMessage using applescript

Does anyone know how to send a group message using applescript/osascript? I've tried a bunch of stuff but nothing seems to work.

从iMessages字典

If you take a look into the iMessages (former iChat) dictionary you see that you only can send messages to a buddy or a text chat . There is no "group" available. BUT, if you have a group, say a list of people, you can compare this to available buddies and send to each one of them, like suggested in this post .

@turingtested's response above led me to a solution that solved this problem for me, provided that there's an already-existing named chat.

In AppleScript's documentation, send can send to a chat :

AppleScript 发送文档

A chat has a name property that is how the chat's name appears in the chat list:

AppleScript 聊天文档

I then went into Messages, created the desired group and added a group name. Once you've done that, the following code will do the trick:

tell application "Messages"
    send "Your message here" to chat "group name"
end tell

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM