Applescript to “Send as Attachment” using Sparrow on Mountain Lion

Hi All,

I was trying to search for some AppleScript which I can use to simulate similar feature as “Send as Attachment” or “Send to Mail Recipient” on Windows. I was able to find few AppleScript which were either doing it using Mail App on Mac or it was not for Mountain Lion. Finally, after few work arounds and googling I was able to make a AppleScript working on Mountain Lion using Sparrow mail client (it can be changed to work with any mail client). I like Sparrow as it is simple and light weight on your resources.

Following is the code snippet from Automator on Mac –

[as]

on run {input, parameters}

set fileList to {}
repeat with i in input
set fileList to fileList & i
end repeat

tell application "Sparrow"
activate
set theMessage to make new outgoing message with properties {subject:"Mail with attachments"}
tell theMessage
repeat with f in fileList
make new mail attachment with properties {filename:f as alias}
end repeat
compose
end tell
end tell

end run

[/as]

For using with another mail client, just replace “Sparrow” with your mail client name on Mac.

Enjoi!

Leave a Reply