Confidential imprinted minutes automation

Hi, just wanted to share something I built and might be of interest.

Scenario
I sometimes write minutes of meetings that address confidential topics, which are sent by e-mail to every attendee as a PDF attachment. Leakage of this information could have an adverse impact on the company, so some actions must be taken to reasonably keep these minutes as secure as possible.

I write my minutes in markdown.

Goal
The goal is to watermark the minutes with a big CONFIDENTIAL sign, and also add the name of the attendee to the watermark, to put further pressure on the recipients.

Problems
There are over 10 attendees, so printing the minute as PDF, then editing duplicates to set up the “CONFIDENTIAL” sign on each page, and then sending the right PDF to each attendee, is very time consuming.

Solution

  1. Use DEVONthink Pro capabilities to duplicate the PDF file, change the file name, and imprint the personalized “CONFIDENTIAL” sign + the name of the recipient.
  2. Use Applescript to automate the process and send the emails.
tell application id "DNtp"
	
	set theSelection to the selection
	
	if (count of theSelection) is 1 then
		
		set theRecord to the content record
		set recordType to (type of theRecord as string)
		
		if (recordType = "PDF document") then
			
			set myList to {{|assistantName|:"First attendee", assistantEMail:"some@email.com"}, {|assistantName|:"Second Attendee", assistantEMail:"other@email.com"}, {|assistantName|:"Third", assistantEMail:"another@email.com"}}
			
			repeat with theItem in myList
				
				set originalName to the name without extension of the theRecord
				
				set newRecord to duplicate record theRecord to the current group
				set newRecordAssistantEmail to assistantEMail of theItem
				set newRecordAssistantName to assistantName of theItem
				set newRecordName to originalName & " - " & newRecordAssistantName as text
				set name of newRecord to newRecordName
				set newRecordPath to path of newRecord
				set myText to "CONFIDENTIAL 
" & newRecordAssistantName as text
				
				
				imprint font "Times New Roman Italic" foreground color {50000, 50000, 50000} position center rotation 65 record newRecord size 80 text myText with outlined -- Add here some formatting
				
				delay 1
				
				-- Mail
				tell application "Mail"
					
					set theFrom to "my@email.com"
					set theTos to {newRecordAssistantEmail}
					set theCcs to {}
					set theBccs to {}
					
					set theSubject to newRecordName
					set theContent to ""
					
					set theMessage to make new outgoing message with properties {sender:theFrom, subject:theSubject, content:theContent, visible:false}
					tell theMessage
						repeat with theTo in theTos
							make new recipient at end of to recipients with properties {address:theTo}
						end repeat
						repeat with theCc in theCcs
							make new cc recipient at end of cc recipients with properties {address:theCc}
						end repeat
						repeat with theBcc in theBccs
							make new bcc recipient at end of bcc recipients with properties {address:theBcc}
						end repeat
						make new attachment with properties {file name:newRecordPath} at after last paragraph
						delay 1
						send
					end tell
				end tell
				--- END MAIL
				
			end repeat
			
			return true
			
		else
			return "Select PDF file"
		end if
		
	else
		return "Select one PDF file"
	end if
	
end tell

How-To

  1. Edit the script with the attendee’s names, emails, and the email of the sender (In this case, myself)
  2. Add the PDF of the minute to DT
  3. Run the script
  4. You’ll get one PDF duplicate for each attendee. I prefer to manually delete them, but you may want to add a delete step to the script, should be fairly easy

Result

  • It works like a charm :slight_smile:
  • I link to the posts where most of the code came from, thank you @DTLow , @Igor_B and of course @BLUEFROG

Keywords

  • IMPRINTER
  • MINUTES
  • CONFIDENTIAL INFORMATION
  • EMAIL AUTOMATION

Links

3 Likes

Very nice!
And interesting that you created the imprint in the script instead of applying an existing one. It’s actually nice as it’s a good example for others that creating such an ad-hoc imprint is possible via scripting!

And thanks for the mention! :relaxed:

2 Likes

Hi Pda0.

Great way to avoid time consuming.

You probably have a list of attendees in .txt/.md/speadsheet.

What if, instead of

set myList to {{|assistantName|:"First attendee", assistantEMail:"some@email.com"}, {|assistantName|:"Second Attendee", assistantEMail:"other@email.com"}, {|assistantName|:"Third", assistantEMail:"another@email.com"}}

you use the list as input — as a file or clipboard?

This would allow to avoid double work and possible errors by changing script.

1 Like