使用 Applescript 在文件夹中显示相同大小的文件

Reveal files of same size in a folder using Applescript

我试图在一个文件夹中显示相同大小的项目,并且正在测试以下代码,但我不断收到此错误:

error "Finder got an error: Can’t get some file of alias \"Macintosh HD:Temp to be Listened to:Temp:Short Temp (Small Files, <20mb):New Folder With Items:\" whose size = \"8890814\" and not 64." 

您知道如何让 Finder 显示与同一文件夹中的另一个文件大小完全相同(但名称不同)的文件吗?这是我想出的代码:

tell application "Finder"
set theFolder to choose folder
set noofFiles to number of files in folder theFolder as text
get some file of theFolder
set theFile to result
print result
display notification name of theFile as text
delay 1
get size of theFile as text
set theSize to result
get (some file of theFolder whose size is equal to theSize and name does not contain theFile)
reveal the result
end tell

谢谢

迟到

您不能将 Finder 文件说明符 (theFile) 与字符串 (name)

进行比较
set fileName to name of theFile
get (some file of theFolder whose size is equal to theSize and name does not contain fileName).

旁注:一直使用 result 是危险的。它始终包含前一行的结果。如果该行没有结果,则它不包含任何内容。