【发布时间】:2018-01-11 11:50:32
【问题描述】:
我想提取 Apple Mac 上已安装应用程序的一些详细信息。我认为在没有任何额外依赖项的情况下在一堆 Mac 上运行它的最便携方式是使用 Applescript。
我可以通过运行得到一个包含 plist 格式的已安装应用程序的变量:
set theAppsList to do shell script "system_profiler SPApplicationsDataType -xml"
但我找不到告诉 Applescript 将此文本解析为 plist 的方法。所有记录在案的 plist 示例都显示了将文件路径传递给 Applescript 的形式:
tell application "System Events" to tell property list file thePropertyListFilePath to ....
但是如何将我从 shell 脚本接收的原始 plist 文本作为 plist 对象处理?是否有一些等效的伪代码:
myPlist = new property list (theAppsList)
这会在内存中创建一个新的 plist 对象吗?
【问题讨论】:
标签: applescript plist