Add matching part of the content as comment

Get help. Get answers. Let others lend you a hand.

Moderator: Mr_Noodle

Add matching part of the content as comment 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!
halloleo
 
Posts: 44
Joined: Thu Apr 27, 2017 10:10 pm

Try the "Content" attribute.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

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…
halloleo
 
Posts: 44
Joined: Thu Apr 27, 2017 10:10 pm

It's not under "Other". It's one of the built-in ones.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

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!
halloleo
 
Posts: 44
Joined: Thu Apr 27, 2017 10:10 pm

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.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

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?
halloleo
 
Posts: 44
Joined: Thu Apr 27, 2017 10:10 pm

Re: Add matching part of the content as comment 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.
smm
 
Posts: 7
Joined: Sun Oct 25, 2015 10:28 am

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.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City

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?
halloleo
 
Posts: 44
Joined: Thu Apr 27, 2017 10:10 pm

Yes.
Mr_Noodle
Site Admin
 
Posts: 11195
Joined: Sun Sep 03, 2006 1:30 am
Location: New York City


Return to Support