I am wanting to use some custom information when Hazel renames a PDF file.
I've run a mdls query in terminal and found the name of the details of the item I want to include (I've annonymised the data):
kMDItemRecipients = (
"\"name of recipient\" <email of recipient>"
I would like Hazel to rename the file with the date and title of the file (I know how to do that) and also the "name of recipient". I don't know how to do that bit
I've tried embedding the following applescript into Hazel and running this before the renaming command:
set posixPath to quoted form of (POSIX path of theFile) as string
set theCustomToken to (do shell script "/usr/bin/mdls -name kMDItemRecipients " & posixPath & " | awk -F ' = ' '{print $2}'")
return {hazelExportTokens:{theCustomTokenValue:theCustomToken}}
I've added the Custom Token as email recipients
Hazel runs the task, renames the file with the date and title but leaves the area for the custom token blank.
I figure it is something simple i've missed but I am really new to scripting. Any help would be greatly appreciated.
Thank you