【发布时间】:2021-05-14 19:12:30
【问题描述】:
我对以下 AppleScript 代码有疑问:
repeat with index from 1 to jpgCount
set currentFile to item index of jpgList
if index is less than 10 then
set numberPrefix to "000"
else if index is less than 100 then
set numberPrefix to "00"
else if index is less than 1000 then
set numberPrefix to "0"
else
set numberPrefix to ""
end if
set fileNumber to numberPrefix & index as string
set the name of currentFile to "2021_0514" & "_" & fileNumber & ".JPG"
end repeat
我在突出显示行 set the name of currentFile to "2021_0514" & "_" & fileNumber & ".JPG" 时遇到错误,这很奇怪,因为它通常可以正常工作。
错误提示:
错误“Finder 出错:无法将别名“Macintosh HD:Users:UserName:Desktop:SourceFolder:TestFile001.jpg”设置为“2021_0514_0001.JPG”。”编号 -10006 来自别名“Macintosh HD:Users:UserName:Desktop:SourceFolder:TestFile001.jpg”
我该如何解决这个问题?
【问题讨论】:
-
您没有提供足够的 code 让我们重现错误。请查看How to create a Minimal, Reproducible Example,然后添加相关的代码以便我们重现错误。
-
错误 -10006 表示
errAEWriteDenied或errOSACantAssign都可能意味着您没有写入权限。不过我可能是错的,我会更深入地研究这一点。
标签: applescript