Automatic Encryption of PDF with PDFPen

From your noodle to other noodles. Talk about ways to get the most from Hazel. Even exchange recipes for the cool rules you've thought up. DO NOT POST YOUR QUESTIONS HERE.

Moderators: Mr_Noodle, Moderators

Automatic Encryption of PDF with PDFPen Sat Dec 15, 2012 8:54 pm • by Scrubbs
I use Yojimbo to file my PDF's but I though folks might be interested in a quick script to embed in hazel to automatically encrypt a PDF before Hazel files it for you...

http://www.scrubbs.me/my-notes-blog/2012/12/15/automatically-encrypting-pdfs-via-pdfpen-in-filing-workflow.

---------------------------
set this_file to theFile
set pass_word to "password"

tell application "PDFpen"
open this_file
save document 1 encrypt using AES256 password pass_word

end tell
Scrubbs
 
Posts: 10
Joined: Mon Jul 16, 2012 9:46 pm

Re: Automatic Encryption of PDF with PDFPen Sun Dec 16, 2012 9:28 pm • by Scrubbs
I updated this to use a password stored in OSX KeyChain.

Details are here:
http://www.scrubbs.me/my-notes-blog/2012/12/16/update-to-automatically-encrypting-pdf-with-pdfpen-via-applescript-and-hazel

Here's the script:
Code: Select all
set this_file to theFile -- use this if you are using hazel

set label to "PDFName" --this is the Name: in Keychain change for whatever you use
set Qlabel to quoted form of label
set t to do shell script "security 2>&1 find-generic-password -gl " & Qlabel
set text item delimiters to "\"" -- Get Password
set tlst to every text item of t
set pw to item 2 of tlst

tell application "PDFpen"
   open this_file
   save document 1 encrypt using AES256 password pw
   quit
end tell
Scrubbs
 
Posts: 10
Joined: Mon Jul 16, 2012 9:46 pm


Return to Tips & Tricks - DO NOT POST QUESTIONS