I’ve updated the post and title a bit.
The macro works for every file of any format. I use it for pdfs but you could also adjust it for a Zettelkasten or academic papers.
It shines when you often have items with similar names where only a specific part of the name needs to be changed. Most likely a date but could also be an ID or version.
It can be used for any task where you’d want to copy the filename of file B
(in the image) and paste it to the file A
. Or you could disable a few steps and just copy the name.
I use it to rename an scanned file to a similar file.
So I might see and select 2023_01_03 Insurance yearly information
in the lower right pane and press the shortcut to prefill the scanned files name with -- Insurance yearly information
and having the cursor where I need to insert the date.
As I wrote it assumes the date format yyyy_MM_dd
at the beginning of the file and also the --
is specific to my usage of Hazel. But I kept it as a template for others to adjust to their file format/usage.