文件的AppleScript集合名称
我对以下AppleScript代码有问题:文件的AppleScript集合名称,applescript,Applescript,我对以下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
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
我在突出显示行时出错,将currentFile的名称设置为“2021_0514”&“0514”&fileNumber&“.JPG”
,这很奇怪,因为它通常工作正常
错误显示:
错误“Finder出现错误:无法将别名“Macintosh HD:Users:UserName:Desktop:SourceFolder:TestFile001.jpg”设置为“2021_0514_0001.jpg”。“别名“Macintosh HD:Users:UserName:Desktop:SourceFolder:TestFile001.jpg”中的数字-10006
如何修复此问题?如注释中所述,您的代码不足以重现错误,但我猜您可以尝试什么。我在顶部添加了3行代码,它们是:
set this_folder to (choose folder with prompt "Pick the folder containing the images to process:") as string
tell application "System Events" to set jpgList to every file of folder this_folder
set jpgCount to count of jpgList
这对我来说非常有效。如评论中所述,错误-10006要么意味着errAEWriteDenied
要么意味着erroscantassign
,这两者都可能意味着您没有写访问权限。
问题可能涉及:
您没有为我们提供足够的代码来重现错误。请查看并添加相关代码,以便我们重现错误。错误-10006表示
errareWriteEdied
或erroscantassign
,这两者都可能表示您没有写入权限。但我可能错了,我会更深入地研究这个问题。