Can anyone shed light on what I’m seeing here because I’m at a loss.
I’m working on a script droplet and was having trouble parsing the files dropped on it in the Finder.
I’ve minimized the code to this example:
on open (theFiles)
display dialog (count theFiles)
repeat with eachFile in theFiles
display dialog (name of (get info for eachFile))
end repeat
end open
(yes, I know this uses deprecated ‘info for’, but this is just quick and dirty and that’s not relevant to the issue at hand since the first line demonstrates the problem).
Saved as a droplet application, it should be pretty clear to most people what it’s trying to do - report the number of files dropped, then display the name of those files in turn. Pretty simple, right?
The problem is that it doesn’t work correctly for files in my ~/Documents folder for reasons I cannot understand.
Let’s say I have 10 documents in my ~/Documents folder named A through J and I select groups of files in alphabetical order
Here’s what I get:
Files Selected | Correct? | # reported | A | B | C | D | E | F | G | H | I | J |
---|---|---|---|---|---|---|---|---|---|---|---|---|
1 | TRUE | 1 | X | |||||||||
2 | 1 | X | ||||||||||
3 | 2 | X | X | |||||||||
4 | 2 | X | X | |||||||||
5 | 2 | X | X | |||||||||
6 | 3 | X | X | X | ||||||||
7 | 3 | X | X | X | ||||||||
8 | 3 | X | X | X | ||||||||
9 | 3 | X | X | X | ||||||||
10 | 4 | X | X | X | X |
The list goes on.
Now it gets really complicated. I can select ANY combination of these files, and the same ones will always be detected/undetected - e.g. if I pick C, D, E, F, G I will get two files (C & F) reported, UNLESS I pick only ‘unblessed’ files that are not normally reported (e.g. I pick unblessed files B, D, E, G) in which case I get them all.
So there is nothing peculiar that I can determine about the files that do or do not work. They are a combination of .pdf, .xlsx, .scpt, .txt files, (except for folders which always seem to work, for some reason).
The files have a series of dates which don’t seem to matter (it’s not only files created in a certain time period)
File size isn’t relevant (files from 0 bytes to several megabytes)
Even more confusingly, I cannot reproduce this in any other folder, including subfolders within ~/Documents, unless I copy unblessed files to a different folder, in which case they continue to be unblessed (I recognize this may be due to limited sample size - I haven’t checked every file/folder on my drive)
Additionally, if I duplicate an unblessed file, the duplicate is also unblessed.
If I duplicate a blessed file, the duplicate is also blessed (so the problem sticks with the file?)
Either way, I think this discounts iCloud/Desktop syncing issues.
Before I lose much more hair, can others try running the script to see if it’s a problem with a) the script (I don’t think so, it’s about as vanilla as you get), b) the Finder, c) my ~/Documents
Thanks