I’am trying to write an automator plugin for the finder wich take the current file, attach it to a new mail with fixed sender and receiver (all of this is easy), but with the filename as the subject of the mail.
Is there a way to do that with Automator ?
Thanks for your help !
If you can’t use this in making a plugin, it might be useful with the “Run Applescript” action. I didn’t have the time to get further than:
tell application "Finder"
set theAttachment to (choose file)
set attachmentName to name of theAttachment
end tell
tell application "Mail"
activate
set newMessage to make new outgoing message with properties {subject:attachmentName}
tell newMessage
set visible to true
end tell
end tell
I hope it helps. If not, at least it’s good practice for me.
j
I finished what I was trying to do. I work in small increments because I am a full time Dad.
tell application "Finder"
set theAttachment to (choose file)
set attachmentName to name of theAttachment
end tell
tell application "Mail"
activate
set newMessage to make new outgoing message with properties {subject:attachmentName}
tell newMessage
set visible to true
tell content
make new attachment with properties {file name:theAttachment} at before first paragraph--because I wasn't adding text to the body
end tell
end tell
end tell
I think this is an improvement, thanks to what I learned here: http://bbs.applescript.net/viewtopic.php?pid=60045#p60045
tell application "Finder"
set theAttachment to (get selection) as alias
set attachmentName to name of theAttachment
end tell
tell application "Mail"
activate
set newMessage to make new outgoing message with properties {subject:attachmentName}
tell newMessage
set visible to true
tell content
make new attachment with properties {file name:theAttachment} at before first paragraph
end tell
end tell
end tell