我正試圖創建一個腳本,通過郵箱「散步」,檢查通訊簿以查看電子郵件的發件人是否已經存在,並將聯繫人添加到通訊簿組(如果找到)。如果未找到電子郵件的發件人,則會在添加到該組之前創建新的聯繫人。如何確定地址簿中是否存在與給定電子郵件地址的聯繫?
到目前爲止,我有這爲集團增加部分:
on addPersonToGroup(person)
tell application "Address Book"
add person to group "wedding guests"
end tell
save addressbook
end addPersonToGroup
這對於通過選定的消息循環:
tell application "Mail"
set selectedMessages to selection
if (count of selectedMessages) is equal to 0 then
display alert "No Messages Selected" message "Select the messages you want to add to 'wedding guests' address book group before running this script."
else
set weddingGuests to {}
repeat with eachMessage in selectedMessages
set emailAddress to extract address from sender of eachMessage
--if emailAddress is found in Address Book then
-- get the person from the Address Book
--else
-- create new person with emailAddress
--end if
--addPersonToGroup person
end repeat
end if
end tell
裏面的「有重複註釋掉的部分eachMessage ...「塊是我還沒有想出來的。
有什麼方法可用於使用AppleScript在地址簿中搜索電子郵件地址?在Mac上是否有其他腳本語言更適合這樣的任務?