Smart Rule to unzip a file with password

Hi there
I usually receive some bank statements by mail, a PDF file in a password-protected-zip file, always the same password. Is there any easy way to unzip the file and add it to the right database using smartRules? I have checked the different possibilities but I have not found anything related to unzip other than using external scripts which is beyond my abilities by now.

Any ideas?

I suppose that your question is about how to do this from within DT3 (which seems a bit unusual to me, but so be it). If not, this is the wrong forum for your question and you be better of at stackexchange, e.g.

AFAIK, there’s no chance of achieving this without a script (not necessarily an external one, though). You have to call unzip with the password somehow, and the only possible way is to use a script. In AppleScript, that would look something like

do shell script "unzip -P " & yourpassword & " " &

If you use this in a smart rule, it would probably look like this (assuming that you ZIP file(s) is/are somewhere in DT3)

on performSmartRule(theRecords) 
set yourpassword to "yoursecretpassword"
tell application id "DNtp" 
repeat with theRecord in theRecords 
do shell script "unzip -P " & yourpassword &  " " & theRecord`
end repeat
end tell

I have not tested this! You might want to read the integrated documentation on Automation and search for shell commands in the automation section of the forum.

If your password is important (like giving you access to your account), you should not store it unencrypted in any script. Never.

1 Like

Sorry, reading your answer I realize I did not explain myself at all. What I want to do is instead of storing the zip file in DT3, storing the PDF file which is inside the zip file. Using DT3 to just uncompress a file makes no sense, you are right.

By default, what I do Is just save the zip file into the GlobalInbox, and my intention is to have a smart rule which detects the file based on a named-based pattern, uncompress, save it to the global inbox and delete the original zip file from the inbox.

As I did not pass beyond uncompressing the file, that’s the reason the question was phrased like that, apologies.

So you are storing the zip in DT, albeit just for a short time. Which means that you have to use a smart rule along the lines I suggested in my first post.

Doing most of it in a shell script seems easier to me: unpack, rename, delete zip, move file into DT.

1 Like