我正在尝试编写一个AppleScript应用程序,以便自动控制联系人组。我正在接收一个联系人项作为脚本的输入,但是我无法理解它。到目前为止,我写的资料来源如下:
script Labels_for_contact_groups
property parent : class "AMBundleAction"
on runWithInput_fromAction_error_(input, anAction, errorRef)
-- Get parameters
set labelName to valueForKey_("trainingLabelName") of parameters() of me
set labelValue to valueForKey_("trainingLabelValue") of parameters() of me
-- Iterate over the contact groups
-- what should I do here?
log input
return input
end runWithInput_fromAction_error_
end script我在日志中得到了以下内容:
2016-10-12 11:35:28.061 Automator[2167:174553] <NSAppleEventDescriptor: [ 'obj '{ 'want':'azf5', 'form':'ID ', 'seld':'utxt'("50E8C441-3DF0-4CD7-8E36-E175B37D2CCB:ABGroup"), 'from':[0x0,10d10d "Contacts"] } ]>我需要做的是提取指定组中所有联系人的信息。我该怎么做?
编辑:我添加了以下几行
tell application "Contacts" to set thePeople to people of input
repeat with i from 1 to number of items in thePeople
set thisPersonCurrent to item i of thePeople
log thisPersonCurrent
end repeat现在,我得到以下错误:
[Labels_for_contact_groups runWithInput:fromAction:error:]: Can’t get every «class azf4» of «class ocid» id «data optr0000000080A9220080600000». (error -1728)我做错了什么?
发布于 2017-04-16 23:46:22
我想要达到的目标并不是通过自动程序实现的。我意识到API中有许多空白。最后起作用的是一个独立的AppleScript,它包含以下一行:
tell application "Contacts"
set theGroupNames to name of groups
set text_returnedCurrent to choose from list theGroupNames with prompt "Select Group" without multiple selections allowed
set the_peopleCurrent to people of group (text_returnedCurrent as text)
...https://stackoverflow.com/questions/39995522
复制相似问题