Hi,
I’m trying to solve a problem created by a recent point update to macOS Sequoia, that means the operating system is no longer generating WhereFrom metadata for video files that are airdropped to the Mac from an iOS device.
I have a nice Hazel workflow that keys on this information, which is now unfortunately broken.
The challenge is I have several iOS devices, and they each need to have different processing done upon them (moving them to set destinations), depending on what device they’re from.
I’ve found a nice commandline solution that can add the metadata necessary:
xattr -w com.apple.metadata:kMDItemWhereFroms TheWhereFromKeyWord /path/to/the.MOV
…which works a treat when applied manually to a file, the WhereFrom does its job in being picked up by Hazel (which cant work directly with EXIF), but I need to figure out if there’s a way to incorporate a step which interrogates the file’s EXIF data, finds the device model, and then applies the appropriate WhereFrom for Hazel to then key against.
Hazel has options to Run a Shell Script, AppleScript, javascript, either embedded or as an external file, which I can add as the first step when the file arrives in ~/Downloads.
For Shell scripts it advises to use $1 to refer to the file being processed, for AppleScript, use theFile to refer to the file being processed, and inputAttributes to access imported attributes…
…and that’s where my understanding of things hits the wall.
It needs some sort of if / then operation where:
if (a model name)
xattr -w com.apple.metadata:kMDItemWhereFroms TheFirstWhereFrom
else if (another model name)
xattr -w com.apple.metadata:kMDItemWhereFroms TheSecondWhereFrom
…perhaps the model names need to be variables, which are set by separate functions that have the template to compare against to get a true / false answer?
My scripting / programming knowledge is barely rudimentary, so apologies… I have a sort of idea of what needs to be done, but that’s about it.
If anyone could provide pointers, I know one thing about myself, I learn concepts by seeing them working, not by understanding the theory beforehand, so help would be appreciated.
Thanks.


