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 に答える