Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/ssh/2.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Applescript got“;“缺少值”;_Applescript_Contacts_Osascript - Fatal编程技术网

Applescript got“;“缺少值”;

Applescript got“;“缺少值”;,applescript,contacts,osascript,Applescript,Contacts,Osascript,我使用以下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 theDat

我使用以下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 运行时{firstName,lastName,workPhone,mobilePhone,workstreet,workzip,workcity,snr} 告诉应用程序“联系人” 将日期设置为当前日期 如果日期不缺少值,则 将日期设置为当前日期 其他的 将日期设置为当前日期 如果结束 将person设置为使用属性{first name:firstName,last name:lastName}创建新的person 告诉别人 在具有属性{label:“Work”,value:workPhone}的电话末尾制作新电话 在具有属性{label:“Mobile”,value:mobilePhone}的手机末尾制作新手机 使用属性{label:“Work”,street:workstreet,city:workcity,zip:workzip}在地址末尾创建新地址 使用属性{label:“Aufnahme”,value:theDate}在自定义日期末尾创建新的自定义日期 在具有属性{服务名称:“Schadennumer”,用户名:snr}的社交配置文件末尾创建新的社交配置文件 结束语 拯救 结束语 终点 如果我跑

osascript kontakt.scpt唐老鸭013333 012345678999 Gansweg 11111 Entenhausen 120-RS-16-831222-2

我得到以下信息


缺少值

AppleScript返回最后一个命令/表达式/语句(如果有)的结果。在这种情况下,这是
save
命令的结果,
missing value
,这可能只是Contacts实现的一个怪癖。如果您不想看到结果,请在脚本末尾粘贴一条简单的
return
语句,这样它就不会返回任何内容。

要知道问题所在,您应该添加一些日志以查看脚本从何处获取缺少的值。对于您的日志,您可以使用“写入文本文件”,或者,更简单的是,在脚本中添加几行“如“步骤X”。如何为applescript添加日志?您可以在脚本中添加说明,如“a”,如“B”:mac将告诉您“a”,“B”,。。。你会知道它在哪里失败。另一个选项是写入文本文件:1)使用TextEdit(转换为基本文本)在桌面上创建一个文件“Log.txt”。2) 在脚本中,添加如下说明:执行shell脚本“echo step1>>/Users/UID/Desktop/Log.txt”(用用户名替换UID,用适当的跟踪替换“step1”)。每次脚本都会在文本文件中写入“step1”、“step2”。查看末尾的文本,您将看到记录的最后一个日志。