【发布时间】:2021-07-30 11:42:22
【问题描述】:
我正在为我的 Apple 脚本而苦苦挣扎。我要求选择一个文件,并且需要将所选文件复制到另一个位置。我是 Apple Scripting 的新手,所以可能犯了一些错误。我尝试了使用“复制”而不是“重复”或“别名”而不是“文件”的不同版本,但到目前为止没有任何效果。希望有人能帮我解决这个问题。
这是我目前编写的脚本(我得到一个 AppleEvent 超时):
set DefaultPath to POSIX file "/Users/jan/Library/Mobile Documents/com~apple~CloudDocs/FOLDER/Test"
set DestFolder to "/Users/jan/Library/Mobile Documents/com~apple~CloudDocs/FOLDER/Destination"
set theFile to (choose file with prompt "Select file:" default location (DefaultPath))
tell application "Finder"
duplicate theFile to folder DestFolder
end tell
【问题讨论】:
-
如果你让你的 DestFolder 引用一个 posix 文件,它应该可以工作。正如所写,它是一个字符串,而不是文件引用。
-
非常感谢,只需稍作改动就可以了。太棒了。
标签: macos automation applescript