Reading the “Where From” meta data using Keyboard Maestro
I was recently presented with this problem. I had dozens of files that had very generic filenames that needed to be sorted. However, the “Where From” meta data contained useful information about the author and content. Problem is, how to use that data?
After searching around, it’s possible to read that information using something similar to:
xattr -px com.apple.metadata:kMDItemWhereFroms '/Users/name/location/location/location/filename.ext' | xxd -r -p | plutil -p -
That’s great, but not exactly useful. But once again, Keyboard Maestro comes to the rescue and can handle the problem with ease. In fact, it doesn’t really require coding, the functionality is all built in.
The first step is to use the
Get Attribute action, and set it to
Where from. That is then stored in a variable and you can manipulate things as you like. I used the Switch/Case statement to have Move/Rename files based on the name it found.
This is then nestled inside a
For Each and you just keep adding more conditions to the
What looked like a rather convoluted process turned out to take no more than a couple of minutes using Keyboard Maestro. When done, I was able to organize dozens of files using different, but completely valid information.
Another win for Keyboard Maestro.
Other articles of interest:
- Making applications with Keyboard Maestro
- More file management with Keyboard Maestro
- Changing the scope of a variable to be available within a Method
- Keyboard Maestro makes a last minute appearance on the Party Barge
- Controlling and Selecting VPN Connections with Keyboard Maestro
- Set up Triple Click Mouse Button Action with Keyboard Maestro
- More fun, and a gamepad, with Karabiner-Elements
- It’s all about templates, macros and workflows in 2020
- Setting up a secondary keyboard for macros
- Excel is not a documentation or testing tool