
AlfredApp.com
This is my first post, and I warn you all by mentioning I’m a novice scripter. My knowledge comes primarily through mass googling as I have no resources locally that have the time, patience, or even knowledge to help me on my own. So here goes:
With Alfred 1.1 we have the ability to throw highlighted text directly to a parameter in Alfred. So for example, dealing with Social Media and Customer Support I wanted a tool i could use from my computer without having to open anything where I could grab some text, toss to Alfred and have it generate an e-mail with that text and send it out to my ticket processing CRM. This lets me focus on the content and later I can go back in and re-tag and edit the tickets I’ve created (and the metrics that now work!). So I wanted two things:
- The ability to create a “Blank” version of my canned message that allowed me to add some notes if I wanted to but that created the ticket e-mail as normal
- The ability to create a “Filled” version of my canned message including the highlighted text I had so I can get back to where I saw the important item – most of the time, this ends up being a URL to a tweet or something.
I created the following AppleScript Extension. At first, I had a bit of problems getting the parameter checked out, but with the help of @AlfredApp and @BinaryGhost, we managed to figure it out:
on alfred_script(q)
set q to q as text
if (q is equal to "") then
log "no parameter"
set alfredInput to "Other"
set q to "Other"
else
log q
set alfredInput to q
end if
using terms from application "Sparrow"
tell application "Sparrow"
activate
set theMessage to make new outgoing message with properties {subject:"CANNED EMAIL SUBJECT - PARAMETER: " & alfredInput, content:"All
This is a canned e-mail being generated by Alfred using an AppleScript Extension. If it contains a parameter, it will be listed below and in the subject.
PARAMETER: " & alfredInput & "
Details (optional): ", message signature:"YOUR SIGNATURE"}
tell theMessage
make new to recipient at end of to recipients with properties {name:"RECIPIENT NAME", address:"RECIPIENT@EMAIL.ADDRESS"}
compose
end tell
end tell
end using terms from
end alfred_script
As you can see in this code the variable “alfredInput” is what will be replaced by the parameter provided and if it is not given, it will default to the text, “Other”. There are a couple of nice features you can toggle in and out of this – the way I’ve written it the cursor will “end” following “Details: ” allowing you to trigger the extension and then begin immediately adding details to whatever it is you’ve started.
Alternatively, you can replace “compose” with “sendmessage” for a truly canned message that will send automatically.
Feel free to grab the extension here: Canned Sparrow E-Mail.alfredextension