Change file permissions with Hazel or AppleScript

Hi Hazel and other gurus - Help!

Recently, I have begun to receive quite a few PDF files that are read only. My Hazel rules won’t work correctly on these files - I assume because Hazel does not have permission to write to the file.

How can I change the file to be read/write by using Hazel or similar? I’ve googled and browsed but haven’t been able to find an answer that I understand!

TIA

A few questions to narrow things down:

  1. What is your Hazel rule attempting to do to the PDF file exactly? You mention writing to the file.
  2. Do these files have a read only permission on the file system? Apple support info on setting/checking this can be found online.
  3. Does the PDF itself have any security on it? e.g. copy protection, password protection - should show in the PDF’s properties.

To answer sylumer’s questions:

  1. The Hazel rule aims to rename the file, add a tag and then move it to a designated folder - it renames but fails to complete the next two steps. I assume it cannot add the tag because the file is read only.

  2. Yes - they are read only.

  3. In some cases, the PDF is locked, however I have another Hazel rule (which is the first rule run on any PDF added to the folder in question) which unlocks the PDF.

Hello, I just finished the Hazel Field Guide.
I’m already using some rules.

One, in particular, that is gonna make my life very easier.

I receive my bank statement every month on email, a encrypt PDF.
The password gave by the bank (kind of an SSN in my country) so I don’t care to write the password on a script.

What I do today:
1 Open the PDF with Preview App
2 Type the password
3 Export as a PDF (this creates a new version, unencrypted)
4 Save to the action folder to Hazel do its magic.

I’ve searched on the forum and found out some people using QPDF.
Since it requires coding knowledge, and I have zero experience, I searched about the security of using Homebrew and found this:

In your opinion, what is the best way to save an unencrypted version of a PDF?

If you are at all worried, continue reading it the manual method you have been using.

Security is a broad topic and many systems, including the Mac, have experienced notable security issues. Personally I have used Home brew for many years. Whilst it is obviously a “silly” error, it was responsibly disclosed and transparently resolved in a timely manner. That actually builds my trust in both parties.

I think QPDF is a versatile tool, and I would potentially use that. But a couple of questions.

  1. How would the SSN be securely stored for use by QPDF.
  2. If the PDF is being supplied with protection, are you sure you want to store it without protection?

I ask this latter one as you are expressing a security concern in another area and I would assume you therefore want o consider the end to end security.

I need to store the PDF statement unencrypted on my local drive, and delete it from email.

Password protecting a PDF statement is useless to me. The password on these statements is meaningless, someone who hacked into an email account can get this information easily.

Since I have no experience with Homebrew, I don’t want to open a breach on my Mac. This is my only security concern.

Can someone suggest a workflow using scrip or Automator?

Thank you

Edit:
I want to automate this workflow: