Page 1 of 1

Help with emailing match words

PostPosted: Thu Apr 27, 2017 5:51 am
by aculee
Hi,

I have a rule that watches a folder for match words (Test1, Test2 and Test3), once found Hazel emails me an email with the file name in the subject line and text in the content of the email.

I'd like the subject line to be {filename} - {matched content1} - {matched content1} - {matched content1} - Content matched.

Link to rule image below:-

https://ibb.co/m50Hd5

Any help would be greatly appreciated.

Re: Help with emailing match words

PostPosted: Thu Apr 27, 2017 10:39 am
by Mr_Noodle
What part are you having a problem with?

Re: Help with emailing match words

PostPosted: Thu Jul 13, 2017 9:00 am
by aculee
Mr_Noodle wrote:What part are you having a problem with?


Hi,
I'd like to include the matched words text in the subject line of the email that is sent but not sure what the syntax is, at the moment the filename is put into the subject line via 'theName' but i'd like to add extra text to the subject line:-

Subject Line: 123456.pdf - Matched content - Test1 AND Test2 AND Test3

Highlighted is the part i'm not sure about the syntax:-

As is ---> {subject:theName, content:"Matched content - Test1 AND Test2 AND Test3", visible:true}
To be --> {subject:theName "Matched content - Test1 AND Test2 AND Test3" , content:"Matched content - Test1 AND Test2 AND Test3", visible:true}

Thanks.

Re: Help with emailing match words

PostPosted: Thu Jul 13, 2017 10:58 am
by Mr_Noodle
The way you have the rule set up now, the file only matches if all three match words are present so your current rule should work.

If you change that to "any" instead of "all", then you'll need to use a custom attribute to match the words. You can then pass the custom attributes into the script (read the help on AppleScript on how to do that) and use those in the subject line.

Re: Help with emailing match words

PostPosted: Fri Jul 14, 2017 10:07 am
by aculee
Mr_Noodle wrote:The way you have the rule set up now, the file only matches if all three match words are present so your current rule should work.

If you change that to "any" instead of "all", then you'll need to use a custom attribute to match the words. You can then pass the custom attributes into the script (read the help on AppleScript on how to do that) and use those in the subject line.


Hi Mr Noodle,

Sorry i don't think i'm being clear enough, I just need to manually add text to the subject line of the email along with the PDF name (which currently gets included in the subject line) but not sure.

Re: Help with emailing match words

PostPosted: Fri Jul 14, 2017 10:44 am
by Mr_Noodle
What do you mean by "manually" here? Could you provide a concrete example of a file going through this workflow?

Re: Help with emailing match words

PostPosted: Mon Jul 17, 2017 8:46 am
by aculee
Mr_Noodle wrote:What do you mean by "manually" here? Could you provide a concrete example of a file going through this workflow?


Hi Mr Noodle,

I'm very sorry that I can't supply a file as they are legal documents.

The pdf word searching/matching and sending of email via Hazel works perfectly (thanks for that) :D .

Email that is sent via the Applescript currently puts the subject line subject:theName as the filename and the subject is text manually written by myself content:"File match words - test1 AND Test2 AND Test3 - belong to etc.... , I would just like to include the subject text on the email subject line too.

So the email that is sent tells the recipient on the subject line of the email A. What words have been matched B. Which file the words got matched in.

Currently what I have:-

Image

What i'd like to have:-

Image

Re: Help with emailing match words

PostPosted: Mon Jul 17, 2017 10:38 am
by Mr_Noodle
Ah, I see. The way you have the script now, that part is in the "content" part. You need to get rid of that and stick it all in the "subject" part. You can use "&" to combine strings.

Re: Help with emailing match words

PostPosted: Tue Jul 18, 2017 4:10 am
by aculee
Mr_Noodle wrote:Ah, I see. The way you have the script now, that part is in the "content" part. You need to get rid of that and stick it all in the "subject" part. You can use "&" to combine strings.


Great!! thanks the solution was so simple :D

Re: Help with emailing match words

PostPosted: Tue Jul 18, 2017 6:45 am
by aculee
Mr_Noodle wrote:Ah, I see. The way you have the script now, that part is in the "content" part. You need to get rid of that and stick it all in the "subject" part. You can use "&" to combine strings.


Mr Noodle, Is there a way to add a line break in the email message sent? using '& return' or '& <br>' does not seem to work when received via Microsoft Outlook.

As is:-

ANONYMITY match words found in file - anothertest-test 23.pdf
File moved to the Exceptions folder for further manual processing.

To Be:-

Test match words found in file - anothertest-test 23.pdf
(Need a line break here)
File moved to the other folder for further manual processing.

Code I have now:-

Image

Thanks.

Re: Help with emailing match words

PostPosted: Tue Jul 18, 2017 10:34 am
by Mr_Noodle
You can use \n. Check out this article: http://alvinalexander.com/blog/post/mac ... -in-dialog