Craig Smith の次のコードを使用しています。
set chatsToKill to {}
tell application "Messages"
set allChats to every chat
repeat with eachChat in allChats
set thePeeps to participants of eachChat
repeat with oneParticipant in thePeeps
if oneParticipant's handle contains "@" then
if chatsToKill does not contain eachChat's id then set end of chatsToKill to eachChat's id
end if
end repeat
end repeat
repeat with deathChat in chatsToKill
delete item 1 of (get every chat whose id = deathChat)
end repeat
end tell
ユーザー ハンドルが 4 桁しかない送信者からの会話を消去する方法があるかどうか疑問に思っていました。
4 桁は常に異なり、同じではありません。さまざまなワイルドカード文字を試しましたが、Applescript がそれらをサポートしていないことがわかりました。