以下是使用AppleScript获取所有未发送的iMessage的示例代码:
tell application "Messages"
set unsentMessages to {}
set iMessageService to 1 -- 1 for iMessage, 2 for SMS
-- Get all conversations
set allConversations to every text chat of service 1 whose service type is iMessageService
-- Loop through each conversation
repeat with thisConversation in allConversations
set thisMessages to (every message of thisConversation) as list
-- Loop through each message in the conversation
repeat with thisMessage in thisMessages
if (was sent of thisMessage) is false then
set end of unsentMessages to thisMessage
end if
end repeat
end repeat
-- Output the unsent messages
repeat with thisMessage in unsentMessages
log "Unsent Message: " & (content of thisMessage)
end repeat
end tell
请注意,此代码将在您的AppleScript编辑器中运行。它将获取所有未发送的iMessage并将其记录到日志中。您可以根据需要对代码进行修改,以满足您的特定要求。