Set custom meta data name based on file name

I have a filename like this:

“Invoice - Mr. Smith - 2345.pdf”

Is it possible to have automatically custom meta tags set based on the file name like this:

Type: Invoice
Customer: Mr Smith
Invoice Numeber: 2345

I use an applescript to assist with processing inbox records (title, tags, etc)
I could add code for such functionality if there’s clear parsing rules
Sample code at See also hits generated by note body text AND note title - #7 by DTLow

1 Like

@DTLow Thanks for your reply. Do you might sharing your script or do you have a simple script as starting point?

@DTLow Thank you very much.

If your filenaming was this uniform, you could use a smart rule to process files…

via this smart rule…


@cgrunenberg : The Scan Name : String doesn’t support ranges, e.g., [0-9] but could it?

Instead of a regular expression, a (somewhat) less nerdy approach might be something like this…

@BLUEFROG Wow. Thank you very much. That was exactly what I was looking for.

You’re welcome :slight_smile:

Do bear in mind, I strongly suggest adding more criteria than just Kind is PDF/PS. A temporal criterion, e.g., Date Added is This Hour will help filter the matches. Adding other actions, like a Move can also help avoid reprocessing files.

Hi, Lynx.
I actually have a similar naming convention.
I use Shortcuts to rename all the files with variables.
What I think is, you may try to add certain symbols before each one of the variables in your naming convention. Like # for tags, @ for people, etc. After that, you may ask someone who knows how to use AppleScript to automatically identify these symbols, and thus update them to the metadata

Thank you for your suggestion.