Seeking scripter for DTPO mini-project

I’m looking for someone to help me with a scripting issue I have. I have a DevonThink database filled with files created by other team members. There are two kinds of files I need a script (or two scripts?) to handle. The inputs are two broad categories of files:

  1. Word files (i.e. .doc and .docx)
  2. PDF files

I have a large quantity of documents of those types that are encrypted with the same password (i.e. thousands) and I would like two scripts (I’m assuming they will be different) that will:

  • work in conjunction with my Mac
  • allow me to use them in Automator / Script Editor
  • take an input of dozens of PDF files, decrypt following the successful input of the password, then output a PDF file that doesn’t have the encryption / password lock.
  • (and the same for the word files; decrypt and leave a copy that isn’t password protected).

For the purposes of a proof of concept, this DTPO database here can be used to try out the script. (The password to open both the test word and pdf file is “password”).

dropbox.com/s/4tyfqvkhvhzy0 … e.zip?dl=0

Ideally, I’ll be able to periodically run the script from the script menu bar directly through DTPO. It’ll go through all the files in the database, decrypt anything new that’s been added that has a password lock.

From what I understand, the word file decryption is easy, but the PDF file less so.

I’d be happy to pay a reasonable fee to someone for crafting these two scripts for me, obviously following mutual agreement here or somewhere off-forum.

Thank you in advance for your help!

Alex

Here’s my offer…drEvil.gif
:mrgreen:

Couldn’t resist

Why are all these documents password protected ? Why not have them unencrypted within the team, and encrypt them when they need to be sent outside the team?

It’s a legacy of things as they were done before I joined. I’m not senior enough to change that policy. But I would like to be able to search the thousands of files within DTPO, which I can’t do currently…

If it’s any extra incentive, I’ll happily post the script(s) here for everyone to use once they’re done. No point them gathering dust on my laptop.

So I didn’t get any suggestions here so I asked on stackoverflow (https://stackoverflow.com/questions/46229231/how-to-batch-remove-passwords-from-word-documents-when-i-know-the-password) for the word document decryption part and there was a suggestion there.

From that, it seemed that it would be relatively easy to code a script myself. I didn’t want to complicate things with DTPO at first, so put together a script that I hoped would work on any folder I chose. It would loop over the items in that folder, and then decrypt them using the Microsoft Word library’s unprotect command. This is the code I put together:

set this_folder to (choose folder with prompt "Pick the folder containing the files to process:") as string
tell application "System Events"
	set these_files to every file of folder this_folder
end tell
repeat with i from 1 to the count of these_files
	set this_file to (item i of these_files as alias)
	set this_info to info for this_file
	if visible of this_info is true and alias of this_info is false then
		tell application "Microsoft Word"
			activate
			open this_file
			unprotect this_file password "samplepassword"
		end tell
	end if
end repeat

Even though unprotect is listed in the MS Word scripting library, when I run this it gives me the following error message:

Any idea what’s going on here? Any help?

Looks like a bug in Word’s AppleScript.