使用AppleScript枚举属性列表项数组
我试图枚举RecentApplication> CustomListItems属性列表项的属性列表文件(.plist)的数组,但是语法有些困难:
tell application "System Events"
set the plist_path to "~/Library/Preferences/com.apple.recentitems.plist"
set the plist_file to property list file plist_path
set itemNodes to property list item "CustomListItems" of property list item "RecentApplications" of plist_file
repeat with i from 1 to number of items in itemNodes
set itemNode to item i of itemNodes
display dialog text of property list item "Name" of property list item itemNode
end repeat
end tell
我收到的错误是:
“系统事件出错了:不能
制作属性列表项的每个文本
属性列表项的“名称”
(财产清单项目
属性列表的“CustomListItems”
item的“RecentApplications”
属性列表文件的内容
“苹果
高清:用户:craibuc:库:首选项:com.apple.recentitems.plist “)
到字符串。“编号-1700来自
属性列表项的每个文本
属性列表项(属性的“名称”
列表项“CustomListItems”的
财产清单项目
“近期应用”的内容
属性列表文件“Macintosh
高清:用户:craibuc:库:首选项:com.apple.recentitems.plist“)
串起来
此外,如果我将代码更改为:
repeat with i from 1 to number of items in itemNodes
display dialog i
end repeat
我得到一个对话框。换句话说,它似乎没有检查数组本身。
捕获PLI阵列的正确方法是什么?
没有找到相关结果
已邀请:
1 个回复
素汞读
我需要添加'属性列表项'。