Reputation: 11
I have the following applescript to add contacts from the command line
on run {firstName, lastName, workPhone, mobilePhone, workstreet, workzip, workcity, snr} tell application "Contacts" set theDate to current date if theDate is not missing value then set theDate to current date else set theDate to current date end if set thePerson to make new person with properties {first name:firstName, last name:lastName} tell thePerson make new phone at end of phones with properties {label:"Work", value:workPhone} make new phone at end of phones with properties {label:"Mobile", value:mobilePhone} make new address at end of addresses with properties {label:"Work", street:workstreet, city:workcity, zip:workzip} make new custom date at end of custom dates with properties {label:"Aufnahme", value:theDate} make new social profile at end of social profiles with properties {service name:"Schadennummer", user name:snr} end tell save end tell end run
if I run
osascript kontakt.scpt Donald Duck 0133333 012345678999 Gansweg 11111 Entenhausen 120-RS-16-831222-2
i get the following
missing value
Upvotes: 1
Views: 3521
Reputation: 3259
AppleScript returns the result of the last command/expression/statement, if any. In this case it's the result of the save
command, missing value
, which is probably just a quirk of Contacts' implementation. If you don't want to see a result, stick a simple return
statement at the end of the script so that it returns nothing.
Upvotes: 2