Page 1 of 1

Add matching part of the content as comment

PostPosted: Wed Jun 02, 2021 4:36 am
by halloleo
I want to create an action where I extract the first date from the content of a PDF and put it in the Finder Comment.

I am aware of your suggestion (from a earlier thread) to look for "match patterns" in the Hazel help, but couldn't find this. Do I use the Text Content attribute (Other -> Text Content)?

(I would like to post a screenshot of where I am, but this is a bit hard here...)

Or do you have a separate tutorial on these document content related modifications?

Thanks for your help in advance!

Re: Add matching part of the content as comment

PostPosted: Wed Jun 02, 2021 9:49 am
by Mr_Noodle
Try the "Content" attribute.

Re: Add matching part of the content as comment

PostPosted: Wed Jun 02, 2021 7:18 pm
by halloleo
Thx Paul.

Where do I find the “content” attribute?

Under Other when i search for content i get the following list:

content created
content creator

Streamable
text content

but no entry just with “content”.

i know i had found it a while a go, but can’t find it know…

Re: Add matching part of the content as comment

PostPosted: Thu Jun 03, 2021 9:41 am
by Mr_Noodle
It's not under "Other". It's one of the built-in ones.

Re: Add matching part of the content as comment

PostPosted: Thu Jun 03, 2021 11:35 pm
by halloleo
Mr_Noodle wrote:It's not under "Other". It's one of the built-in ones.


Really? I must have tomatoes on my eyes, but I can't find it:

Image

Hard to find for me. (I know I had found it before!) - A tutorial/blog post on how to do content matching would be a great help, I guess...

Anyway, thanks for being very responsive here!

Re: Add matching part of the content as comment

PostPosted: Fri Jun 04, 2021 9:27 am
by Mr_Noodle
Whoops, sorry, I was confused and was thinking in the conditions, not a match pattern.

I don't believe that is available. There might be "Text content" but chances are that won't actually insert anything. Probably for good reason as most content is relatively large compared to other fields, like comments. You will need to write a script to do this for you in this case.

Re: Add matching part of the content as comment

PostPosted: Sat Jun 05, 2021 5:46 am
by halloleo
Mr_Noodle wrote:Whoops, sorry, I was confused and was thinking in the conditions, not a match pattern.


Ah, this makes sense. Is there any way to use a matched expression from a condition in the Add comment or Rename action?

Re: Add matching part of the content as comment

PostPosted: Sat Jun 05, 2021 7:08 am
by smm
halloleo wrote:Is there any way to use a matched expression from a condition in the Add comment or Rename action?


I believe you can add custom expressions to comments.

Re: Add matching part of the content as comment

PostPosted: Mon Jun 07, 2021 9:41 am
by Mr_Noodle
Yes, you can use custom attributes in a comments pattern. You will probably need to have a script to suck the text out, put it into a custom attribute and export that back to Hazel. The manual has more details on how to do that from AppleScript.

Re: Add matching part of the content as comment

PostPosted: Tue Jun 08, 2021 10:24 am
by halloleo
Mr_Noodle wrote:Yes, you can use custom attributes in a comments pattern. You will probably need to have a script to suck the text out, put it into a custom attribute and export that back to Hazel. The manual has more details on how to do that from AppleScript.


Tanks for this. With the manual, do you refer to the help?

Re: Add matching part of the content as comment

PostPosted: Wed Jun 09, 2021 9:55 am
by Mr_Noodle
Yes.