The Many Tiny Cuts:
When I (or you) use an AppleScript droplet to process a group of files (e.g. encoding video using ff•works, or resizing and watermarking images using Pixelmator Pro), some inconsistent subset of those files doesn’t get processed, some of the time, maybe. This has meant a lot of doublechecking and comparing lists of files every time I make something. Sometimes I miss it and don’t notice until later, then I hope I’ve still got the source file.
The act of opening (not saving, opening) a file in any of a wide range of applications (including QuickTime Player and Preview) sets a quarantine flag on that file which makes it play very poorly with droplets. Dropping a mixed set of files with and without this flag will result in all the flagged files being silently skipped - the script inside the droplet will never see them. Just for fun, if you drop only files with this flag set, they won’t be skipped.
Understanding and Workaround:
- Export a set of pictures or videos from your content creation tool of choice 1 - File A, File B, File C, File D.
- Double-click File B to open and double-check that it looks about right.
- Select all four files, drag them onto some droplet
- Wonder why only Files A, C, and D are processed
- (optional) agony, strife, blame the processing tool
- write a script to log what files the droplet is actually receiving, e.g.
on open theDroppedItems set myLogFile to open for access POSIX file "/var/tmp/dropped.log" with write permission write "opened with " & length of theDroppedItems & " items" & return to myLogFile starting at eof repeat with a from 1 to length of theDroppedItems set theCurrentDroppedItem to item a of theDroppedItems set filePath to (the POSIX path of theCurrentDroppedItem) write filePath & return to myLogFile starting at eof end repeat close access myLogFile end open
then watch the log file and note that File B isn’t even being received!
- drop just File B, see it logged normally. Notice it only gets skipped if you drop any other files with it.
- open File D in QuickTime Player or whatever. After this note that both B and D get skipped when you drop, but only if you include A and/or C in the selection.
- find this mention of the quarantine flag having odd effects on droplets.
- Find this set of posts documenting that opening files in any sandboxed application (including QuickTime Player and Preview, i.e. doubleclicking on any video or picture) sets the quarantine flag, because why not?
ls -l@combined with the logging script above to confirm the behavior.
- use Sandstrip or Pratique to remove the flags (Sandstrip strips the flag, but reopening the file will set it again. Pratique sets the file as having cleared quarantine in a way which makes it much less likely the flag will be re-set). Add yet another fiddly step to your everyday workflow.
- Wish you’d created something today, instead of fighting with your ‘creative’ tools. This appears to have been a thing for a while, hi Apple!
FCPX and Resolve both create files with the flag not set. Pixelmator Pro creates files with it already set. One of my preferred thumbnail-building tools does, one doesn’t. I haven’t touched Photoshop in years (yay Pixelmator!) so 🤷♂️. Downloading a jpeg via Transmit, not set. Surveying my Pictures folder reveals a random assortment of set and unset. ↩