我正在尝试创建AppleScript,以在重命名文件时将单个文件复制到新位置。我对文件的重命名很挂念。
我尝试设置“带有属性”,设置别名,但仍然出现错误。
tell application "Finder"
set JobName to text returned of (display dialog "Please Enter Crate Name:" default answer "Job_Name")
set loc to alias "Volumes:MusicExt:_Serato_:Subcrates:"
set templatefile to alias "Volumes:MusicExt:Serato_Working:crate-template.crate"
duplicate file templatefile to loc --> with properies {name:JobName}
duplicate file templatefile to loc --> with properies {name:"10. Pre-CMY.m3u"}
end tell
答案 0 :(得分:1)
Volumes
开头。file
关键字放在alias
指定符的前面使用Finder,您需要执行两个步骤:复制文件,然后重命名。
利用duplicate
的返回值(即重复的文件)。
tell application "Finder"
set JobName to text returned of (display dialog "Please Enter Crate Name:" default answer "Job_Name")
-- In this case just HFS string paths are preferable
set loc to "MusicExt:_Serato_:Subcrates:"
set templatefile to "MusicExt:Serato_Working:crate-template.crate"
set duplicatedFile to duplicate file templatefile to folder loc
set name of duplicatedFile to JobName -- (& ".crate") is there no file extension??
end tell
注意:with properties
仅与make
命令一起使用。