Mac Mail Download PDF Attachments Apple Script Help. Please.

Hi. I am using Mail 5.3 and need a script that will automatically download PDF attachments to a select folder on my network.

I have been searching the net and there a couple scripts available (most require the use of a Mail run to activate the script) but I have not been able to get them to function correctly or they have additional scripting which is not applicable.

The script is simple:

Every time Mail receives a message.

The script checks for PDF attachments.

If a PDF attachment exists it downloads the file to a folder on the network.

When I try to write it (or use known examples) they don’t work…i am probably overthinking it :frowning:

Thank you for your time and consideration

R260

this what i have so far. it does work but it doesn’t take into account if the file all ready exist. so in other words if x.pdf exists and i send a new mail with change to x.pdf it does not over write.

i have a mail rule setup that says if ANY attachment type IS pdf run the following script

using terms from application "Mail"
	on perform mail action with messages theMessages for rule theRule
		set attachmentsFolder to "VOLUME:FOLDER:" as rich text
		tell application "Mail"
			set selectedMessages to theMessages
			try
				repeat with theMessage in selectedMessages
					repeat with theAttachment in theMessage's mail attachments
						set originalName to name of theAttachment
						set savePath to attachmentsFolder & originalName
						save theAttachment in file (savePath)
					end repeat
				end repeat
			end try
		end tell
	end perform mail action with messages
end using terms from

i know this would be easier if i was running a newer version of mac mail but this is all i have :frowning:

thank you R