简体   繁体   English

我无法使用Applescript在一组选定的电子邮件中(在Mail.app中)选择“第一条消息”…

[英]I can't choose the “first message” in a group of selected emails (in Mail.app) using Applescript…

So I can iterate through a group of emails to using: 因此,我可以遍历一组电子邮件以使用:

repeat with eachMessage in emailSelection
        log content of eachMessage
        set theContent to content of eachMessage
    end repeat

Yet when I try to arbitrarily select one, say the first one in the set, I get an error 但是,当我尝试任意选择一个(例如集合中的第一个)时,出现错误

        set newContent to content of first message in emailSelection

returns: 收益:

( Can't get message 1 of {message id 740166 of mailbox "INBOX" of account "IMAP PL" of application "Mail", message id 740165 of mailbox "INBOX" of account "IMAP PL" of application "Mail", message id 739792 of mailbox "INBOX" of account "IMAP PL" of application "Mail", message id 740164 of mailbox "INBOX" of account "IMAP PL" of application "Mail", message id 738259 of mailbox "INBOX" of account "IMAP PL" of application "Mail", message id 738258 of mailbox "INBOX" of account "IMAP PL" of application "Mail", message id 738257 of mailbox "INBOX" of account "IMAP PL" of application "Mail"}. ) 无法获得应用程序“邮件”的帐户“ IMAP PL”的邮箱“ INBOX”的{消息ID 740166的消息1,应用程序“邮件”的帐户“ IMAP PL”的邮箱“ INBOX”的消息ID 740165,消息应用程序“邮件”的帐户“ IMAP PL”的邮箱“ INBOX”的ID 739792,应用程序“邮件”的帐户“ IMAP PL”的帐户“ IMAP PL”的邮箱“ INBOX”的消息ID,帐户“邮箱”的邮箱“ INBOX”的消息ID 738259应用程序“邮件”的IMAP PL”,应用程序“邮件”的帐户“ IMAP PL”的邮箱“ INBOX”的消息ID 738258,应用程序“邮件”的帐户“ IMAP PL”的邮箱“ INBOX”的消息ID 738257。

I want to select the first object in the set of emails but it seems to be trying to identify an email message id of "1" which obviously is not included in the set of selected emails. 我想选择电子邮件组中的第一个对象,但是它似乎正在尝试标识电子邮件ID为“ 1”,这显然不包括在所选电子邮件组中。

You need to reference emailSelection as a list using the item keyword. 您需要使用item关键字将emailSelection引用为列表。

eg, 例如,

set newContent to content of (item 1 of emailSelection)

or 要么

set newContent to content of (the first item of emailSelection)

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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