我有以下AppleScript从命令行添加联系人
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
如果我跑
osascript kontakt.scpt Donald Duck 0133333 012345678999 Gansweg 11111 Entenhausen 120-RS-16-831222-2
我得到以下
缺少值
答案 0 :(得分:2)
AppleScript返回最后一个命令/表达式/语句的结果(如果有)。在这种情况下,它是save
命令missing value
的结果,这可能只是联系人实现的一个怪癖。如果您不想看到结果,请在脚本末尾添加一个简单的return
语句,以便它不返回任何内容。