如何解决AppleScript 中的简单移动文件
我四处寻找并确实找到了有效的代码,但我不明白为什么我的简单版本不起作用而更复杂的版本却起作用了:
“无法获取“Macintosh HD:Users:Andrew:Downloads”的全部内容。”
tell application "Finder"
move entire contents of DownloadsFolderAddress to StatementFolderAddress
end tell
但是这段代码有效吗??
tell application "Finder"
set AllStatementsList to get every item of (entire contents of folder DownloadsFolderAddress)
move AllStatementsList to StatementFolderAddress
end tell
很好奇为什么第二个例子有效而不是第一个例子
解决方法
错误很明显:您无法获取文字字符串的内容。
第二个示例有效,因为您指定了 folder
。
有时 Finder 可以推断类型,但最好始终指定它。
假设 StatementFolderAddress
也是文件夹的 HFS 路径
tell application "Finder"
move entire contents of folder DownloadsFolderAddress to folder StatementFolderAddress
end tell
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。