2

我正在尝试在 Applescript 中编写代码,以便与已填写的信息建立新的联系。这是我的代码:

set contactFirstName to "Brandon"
set contactLastName to "Damante"
set contactStreet to "7688 Somerly Ct"
set contactCity to "New Albany"
set contactCountry to "USA"
set contactZip to "43054"
set contactEmail to "chocolatecheese101@hotmail.com"
set contactNote to "I'm Awesome"
set contactState to "Ohio"
--Address Book Tell Block
tell application "Address Book"
    --Create the Contact
    set theContact to make new name with properties {first name:contactFirstName, last     name:contactLastName, street:contactStreet, city:contactCity, state:contactState,     country:contactCountry, zip:contactZip, email:contactEmail, note:contactNote}
end tell

它突出显示粗体部分并说:“无法将应用程序'地址簿'转换为类型位置引用”,我以前从未见过该错误消息。这对我的代码意味着什么?我该如何纠正?

4

1 回答 1

1

试试这个:

set contactFirstName to "Brandon"
set contactLastName to "Damante"
set contactStreet to "7688 Somerly Ct"
set contactCity to "New Albany"
set contactCountry to "USA"
set contactZip to "43054"
set contactEmail to "chocolatecheese101@hotmail.com"
set contactNote to "I'm Awesome"
set contactState to "Ohio"
--Address Book Tell Block
tell application "Address Book"
    set theContact to make new person at end of people with properties {first name:contactFirstName, last name:contactLastName, note:contactNote}
    tell theContact
        make new address at end of addresses with properties {street:contactStreet, city:contactCity, state:contactState, country:contactCountry, zip:contactZip, label:"Work"}
        make new email at end of emails with properties {label:"Work", value:contactEmail}
    end tell
    save
end tell
于 2012-09-30T21:12:12.530 回答