I'm trying to reveal items of the same size in a folder, and am just testing out the following code, but I keep getting this error:
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."
Do you know how I can get the Finder to reveal a file that is the exact same size as (but with a different name to) another file in the same folder? Here's the code I came up with:
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
Thanks
Tardy
You cannot compare an Finder file specifier (theFile
) with a string (name
)
set fileName to name of theFile
get (some file of theFolder whose size is equal to theSize and name does not contain fileName).
Side-note: Using result
all the time is dangerous. It contains always the result of the preceding line. If that line has no result, it contains nothing.