Hi
I’ve created a droplet so that when I drop a file on there, it adds the file as an attachment to a new email message in Outlook (on the mac), the script also takes the filename and adds it to the subject line and adds a default email message that includes a reference to the file.
--Creates a new mail message when a file is dropped on the script droplet, the subject is the filename--
on open Dropped_File
tell application "Finder"
set NameOfFile to (name of (info for Dropped_File))
set myFile to Dropped_File as alias
--display dialog NameOfFile
end tell
tell application "Microsoft Outlook"
set mySubject to NameOfFile as text
set myContent to "<p style=font-family:Calibri>Hi</p><p style=font-family:Calibri>Attached is a LoRes PDF for job " & NameOfFile & "<p style=font-family:Calibri>Thanks</p>"
set myAttachment to Dropped_File
set myMsg to make new outgoing message with properties {subject:mySubject, content:myContent}
tell myMsg
make new attachment with properties {file:myFile}
end tell
open myMsg
end tell
end open
I want to expand the droplet a bit more.
The files I drop on there have a consistent filename structure: 11-CH-16 Job Description (100x100)_v1.pdf - (so this is a job number made up of 2 digits hyphen 2 characters hyphen 2 or 3 characters; then a job description; a size within brackets; and then an underscore and version number).
So firstly I’d like the script to just add the job number to the subject line, so I need to implement some GREP into the script to pull this from the filename. I’m stuck on this bit. I know the GREP would be something like [\l\u]{2}±\d{2}±\d{1,4} but I’m not sure how to get this into the script
The second thing I like the droplet to do is accept multiple files being dropped onto it. The multiple files would all have the same job number.
Any help would be great
Thanks in advance
David