arjunrc Posted April 17, 2013 Share Posted April 17, 2013 (edited) Hi, I am looking to create a workflow that sort of works like the current "email" keyword, but allows me to send emails to multiple people, not just one person (like the email keyword currently does). However, I want it to resolve the addresses from my mac address book. Something like this: "multiemail Arjun" - right then, it should search my contacts bring up all options and let me select the right email, say via tab, then I can add "commas" and add more people. Finally hit enter and it passes all the names along with emails to my email client. Is this possible? How do I start? (Note I use lotus notes, not mail.app but its set as my default email client, so mailto: works with LN) Edited April 17, 2013 by arjunrc Link to comment
jdfwarrior Posted April 18, 2013 Share Posted April 18, 2013 Hi, I am looking to create a workflow that sort of works like the current "email" keyword, but allows me to send emails to multiple people, not just one person (like the email keyword currently does). However, I want it to resolve the addresses from my mac address book. Something like this: "multiemail Arjun" - right then, it should search my contacts bring up all options and let me select the right email, say via tab, then I can add "commas" and add more people. Finally hit enter and it passes all the names along with emails to my email client. Is this possible? How do I start? (Note I use lotus notes, not mail.app but its set as my default email client, so mailto: works with LN) It may be possible but it would be a little complicated. Alfred currently uses the native Contacts API to search contacts. We would have to search contacts ourselves and.. seems like I found a way to do it once but it's not coming to me right this sec. Regardless, several users have requested the ability to be able to search contacts more efficiently so, maybe some day Andrew will provide us with the ability to do that via a workflow module. Link to comment
arjunrc Posted April 18, 2013 Author Share Posted April 18, 2013 David, thanks. Would it be possible for you to post an osascript that iterates through my address book and prints "name and email" like so: Bob Durke, bob@foo.com Bob Durke, bob2@moo.com Arjun RC arc@peace.org Shelly shz@nn.com I am not conversant with osascript at all. I tried osascript -e "tell app \"Address Book\" to get the (name,email) of every person" And i think its outputting a hash, not sure how to traverse it. OnceI have that script, I plan to import it into perl and then search it and return it as alfred items and take it on from there Link to comment
arjunrc Posted April 19, 2013 Author Share Posted April 19, 2013 (edited) Okay, so far I've managed to get a list of contacts based on keywords. I have a script filter based on keyword 'mem' (for now) that does this /usr/bin/sqlite3 -separator '!:!' ~/Library/Application\ Support/AddressBook/AddressBook-v22.abcddb "select e.ZADDRESSNORMALIZED, p.ZFIRSTNAME,p.ZLASTNAME from ZABCDRECORD as p,ZABCDEMAILADDRESS as e WHERE e.ZOWNER = p.Z_PK;" | grep -i {query} >temp.names This script basically searches your mac address book for your argument and outputs first,last names and their emails to temp.names I then invoke findaddr.pl via /usr/bin/perl ./findaddr.pl That outputs the names and emails in a nice itemized list for Alfred to display on the fly The code for findaddr.pl open (FH, "<temp.names") || die "No names"; print "<?xml version='1.0'?><items>"; while (<FH>) { next if /^(\s)*$/; chomp; ($email,$first,$last)=split('!:!',$_); print <<EOF <item uid="$first" arg="$email" valid="yes"> <title>$first $last</title> <subtitle>$email</subtitle></item> EOF } print "</items>"; So where I am right now is the workflow is showing all emails and names that match my query. What I need to do next is to let the user somehow select multiple entries. How do I go about doing that in alfred? Once I have that done, I'll add comma support Edited April 19, 2013 by arjunrc Link to comment
arjunrc Posted April 19, 2013 Author Share Posted April 19, 2013 Yay - got it all working - will post soon Link to comment
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now