【发布时间】:2017-07-27 12:05:47
【问题描述】:
do shell script "mdfind kMDItemCFBundleIdentifier = com.test.sample > ~/Documents/sampleBuilds.txt"
set homeFolder to (path to home folder)
set sampleFiles to paragraphs of (read POSIX file (POSIX path of homeFolder & "/Documents/sampleBuilds.txt"))
if (count of sampleFiles) is 0 then
display notification "No Sample builds are present on the system"
else
set sampleFiles to paragraphs of (read POSIX file (POSIX path of homeFolder & "/Documents/sampleBuilds.txt"))
display dialog "You have " & (count of sampleFiles) & " build(s) of Sample on your system. Would you like to remove them all? This cannot be undone"
repeat with c in SampleFiles
do shell script "rm -rf " & (quoted form of c)
display notification "Sample build located at " & c & " has been removed from your system"
end repeat
do shell script "rm -rf ~/Documents/SampleBuilds.txt"
end if
当使用正确的发件人将脚本放入 Xcode 时,我收到错误:
[AppDelegate testScript:]:无法将当前应用程序转换为类型文件。 (错误-1700)就行了
将 sampleFiles 设置为(读取 POSIX 文件(homeFolder 的 POSIX 路径和“/Documents/sampleBuilds.txt”))的段落
关于如何让 AppleScript 应用程序中的 Xcode 接受此脚本有什么想法吗?
【问题讨论】:
标签: xcode applescript applescript-objc paragraphs