Hello,
this is my first post here, I need a little help or hint:
I’m struggling making a super simple task in Automator: I need to create a Finder service that is able to add a whole folder as attachment to a mail with precompiled text. I don’t know why it works only if I select a file, when selecting a folder I get an error "OSStatus -10000”.
The reason why I may need to add the whole folder is because I can have files with the same name (e.g. Report.pdf) in different folders (e.g. 2024-12-31 and 2024-12-30).
E.g. I want to select both folders 2024-12-30 and 2024-12-31 and with a single click have a precompiled mail with a standard text and recipients ready to send with the two folders attached.
Of course the script must work in case I select a file, but this is already working.
To reproduce the error, the script can be extremely simple and easily reproducible:
- create new email
- get specified finder items (adding a folder)
- add attachment to front message.
The strange thing is that the “add attachment to front message” action should accept both files and folders, as stated in Automator.
When right clicking a folder and sharing with mail from Finder it gets added correctly to a new email, so there must be a way to solve this problem.
Thank you very much and happy new year everybody
Maybe add in a “create archive” in between “Get specified finder items” and “add attachment?”
Andrew
Hello Andrew, thank you for your nice suggestion.
This is a solution that I thought about, but when I attach simple files instead of folders I don’t like them to be compressed, because without compression is easier to preview them in sent mail folder with quicklook!
Maybe there is a way with AppleScript? I’m super newbie to AppleScript, I tried copying a script found somewhere on the internet that creates a precompiled mail with the attachment, but worked only with files and not with folders…I suspect this is a bug
I believe that folders can be anttached only if they are zipped first. Perhaps selecting the folder, then sorting through the files until a match for report.pdf is found and attaching only that file?
Andrew
This unfortunately would not work since “report.pdf” is an example name I used to explain, the actual name inside the folder can be different from case to case.
I think one possible workaround would be perform the zipping only if I select a folder, otherwise attach the plain file. And possibly automatically delete the zipped file after the mail is successfully sent.
Can this be achieved? I think this should be written in an AppleScript inside Automator
Yes, it does seem like this is possible. I’m wondering what else is in the folder. Are there other pdfs or just the report? If it’s the only pdf in the folder, that would be an easy filter. Alternatively, can the reports be named in such a fashion that they have something unique to the file name so they can be filtered out by the script? “Something something report.pdf” could be filtered for “report.pdf.”
The folder can contain 1, 2, 3 up to an indefinite number of files, all PDFs. When there is only one, I tend to attach the file directly to the mail, while if there are more than one I used to attach the folder, but attaching a zip file can work also.
I would not like to edit the file names, since they come out straight from a survey procedure (in my case is SafetyCulture)
I think it should be created an applescript that reads the kind of input file, if it’s “folder” → compress → mail, otherwise attach directly to mail