Email 正在删除文本,请单击Applescript

Email 正在删除文本,请单击Applescript,email,copy,paste,apple-numbers,Email,Copy,Paste,Apple Numbers,因此,我制作了一个脚本,允许我复制电子邮件的发件人并将其粘贴到数字文档中,复制的地址列出了两个不同的电子邮件,我需要删除其中一个 告诉应用程序“邮件” 将子列表设置为{} 将消息设置为消息查看器0的选定消息 用消息中的消息重复 将子列表的结尾设置为{A消息收件人的地址,“,或”} 结束重复 将AppleScript的文本项分隔符设置为“” 将剪贴板设置为(子列表为字符串) 将AppleScript的文本项分隔符设置为“” 嘟嘟声 结束语 告诉应用程序“编号”告诉文档1告诉工作表1告诉表1 将单

因此,我制作了一个脚本,允许我复制电子邮件的发件人并将其粘贴到数字文档中,复制的地址列出了两个不同的电子邮件,我需要删除其中一个

告诉应用程序“邮件”
将子列表设置为{}
将消息设置为消息查看器0的选定消息
用消息中的消息重复
将子列表的结尾设置为{A消息收件人的地址,“,或”}
结束重复
将AppleScript的文本项分隔符设置为“”
将剪贴板设置为(子列表为字符串)
将AppleScript的文本项分隔符设置为“”
嘟嘟声
结束语
告诉应用程序“编号”告诉文档1告诉工作表1告诉表1
将单元格“a1”的值设置为(剪贴板为文本)
结束语
告诉应用程序“编号”告诉文档1告诉工作表1告诉表1
将单元格“b1”的值设置为当前日期

end tell
您可以将所有发件人拆分为单独的文本项,并选择仅复制第一个邮件地址,如下所示。如果要保留第二个地址并删除第一个地址,可以将
文本项1
更改为另一个文本项

tell application "Mail"
    set theSenderList to {}
    set theMessages to the selected messages of message viewer 0

    repeat with aMessage in theMessages
        set end of theSenderList to {address of to recipients of aMessage, " OR"}
    end repeat

    set AppleScript's text item delimiters to " "
    -- Set all the senders to a string
    set allSenders to (theSenderList as string)
    -- Sort these senders by " Or "
    set AppleScript's text item delimiters to " OR "

    -- Get every sender as an individual text item
    set everySender to every text item of allSenders

    -- Set the clipboard to the first sender
    set the clipboard to (item 1 of everySender as string)

    beep
end tell

tell application "Numbers"
    -- Try to add to open document in Numbers
    try
        tell document 1 to tell sheet 1 to tell table 1
            set value of cell "a1" to (the clipboard as text)
            set value of cell "b1" to current date
        end tell
    on error -- Create a new document if there is currently no document open
        set myDocument to make new document
        tell document 1 to tell sheet 1 to tell table 1
            set value of cell "a1" to (the clipboard as text)
            set value of cell "b1" to current date
        end tell
    end try
end tell