我有一个脚本,我需要在使用该脚本创建文件夹的位置(如下)编写,但由于其命名方式,无法弄清楚如何将文件复制到创建的文件夹中。
set foo to computer name of (system info)
tell application "Finder"
set home_path to home as Unicode text
set targetFile to (home_path & "Library:Logs:Xxxxx.log")
set p to (path to desktop)
try
set targetPath to make new folder at p with properties **{name:"XXX-X-XXXX" & foo}**
duplicate file targetFile to targetPath
end try
end tell
我想我可以写一个这样的脚本。
set foo to computer name of (system info)
tell application "Finder"
set p to (path to desktop)
set home_path to home as Unicode text
set targetFile to (home_path & "Library:Logs:Xxxxx.log")
set p to (path to desktop)
try
set targetPath to p & {name:"LOGS-I-NEED" & foo}
duplicate file targetFile to targetPath
end try
try
on error the error_message number the error_number
display dialog "Error: " & the error_number & ". " & the error_message buttons {"OK"} default button 1
end try
end tell
但我得到这个错误
--> 错误编号 -1700 从 {alias "Macintosh HD:Users:dorianglanville:Desktop:", "LOGS-I-NEEDDorian's MacBook"} 到文件夹
我觉得我错过了一些简单的东西,但一直盯着它看太久了,我不再“看到”它。
多谢你们!