Automation 使用AppleScript发送消息

Automation 使用AppleScript发送消息,automation,applescript,messages,Automation,Applescript,Messages,我可以向已经使用buddy东西的指定人员发送消息。我在iMessage上注册了多封电子邮件,因此我想知道如何在实际脚本中选择发送邮件的帐户 我没有尝试过任何东西,因为我不太熟悉AppleScript 例如: 将acc1设置为coolemail1@emails.com 将acc2设置为coolemail2@emails.com 我想从coolemail1发送“你好”,从coolemail2发送“你好吗?” 我怎么能这样做 -我真的不擅长提问抱歉发件人帐户是邮件的发件人属性 此发件人通常采用联系

我可以向已经使用buddy东西的指定人员发送消息。我在iMessage上注册了多封电子邮件,因此我想知道如何在实际脚本中选择发送邮件的帐户

我没有尝试过任何东西,因为我不太熟悉AppleScript

例如:

  • 将acc1设置为coolemail1@emails.com
  • 将acc2设置为coolemail2@emails.com
我想从coolemail1发送“你好”,从coolemail2发送“你好吗?”

我怎么能这样做


-我真的不擅长提问抱歉

发件人帐户是邮件的发件人属性

此发件人通常采用联系人姓名的形式

要仅提取电子邮件地址并与您的acc1/acc2进行比较,您必须使用“提取地址自”说明

参见下面的示例:

set Acc1 to "coolemail1@emails.com"
set acc2 to "coolemail2@emails.com"
tell application "Mail"
set theMails to every message of inbox whose subject contains "your selection"
repeat with I from 1 to count of theMails
set My_Sender to extract address from sender of item I of theMails
if My_Sender is Acc1 then
   -- do something
   else
   -- do something else for the second name
   end if
end repeat
end tell