<<< Date Index >>>     <<< Thread Index >>>

Re: muttquery



On Thu, Dec 25, 2003 at 06:51:12PM +1100, Ricky Buchanan wrote:

> Anyway,  have situations in OTHER programs where I have to look up email
> addresses, on occasion, and it'd be REALLY handy if instead of looking
> up and getting the output like this:
> 
> Searching through 475 addresses in pilot address book.
> frayah@xxxxxxxxxxx    Anne Oberin     
> rb@xxxxxxxxxxxxxx     Penguin Ricky Buchanan  
> Colin.Oberin@xxxxxxxxxx       Colin Oberin    Dad Father
> kase@xxxxxxxx Hayden Oberin   
> kaysik@xxxxxxxxxx     Ptolemy Oberin  
> 
> Then for cases where there's >1 entry, I'd like mutt's
> query-answer-choosing program to come up, let me choose the answer, and
> return it to stdout like, for example
> 
> rb@xxxxxxxxxxxxxx
> 
> still using the previous example.  And, like with mutt, in the previous
> example it would automatically choose and return one address if the
> query program returned only one.
> 
> Possible to do/access from the command line?

You can use a muttrc like this:

#This will simply print the address chosen to stdout:
set sendmail="echo"
#This is your cool adress-getting script:
set query_command="your-funky-palm-thingy"
#This way, Mutt won't abort (alternative is abort_unmodified=no):
editor="touch"
#This might do the trick (filling in blahblahblah for the subject):
macro generic y "<select-entry>blahblahblah<send-message>"
#This hopefully works if the obove doesn't ... haven't tried it:
send-hook . "exec send-message"
#This tells Mutt to get us underway automatically:
push "<mail><query>"

Then, set up a shell script like this:

#!/bin/sh
mutt -F our_muttrc_above

Now, if I did everything correctly above, running that script with an RC
file approximating the above should get you pretty close to what you want.
If not, fool around with it, and report here what finally works :-)

> How hard/easy to hack up
> a part of Mutt to do it as a standalone program, would people think?

That's probably easier and more reliable, if you're familiar with the
source code.

HTH,
 - Dave

-- 
Uncle Cosmo, why do they call this a word processor?
It's simple, Skyler.  You've seen what food processors do to food, right?

Please visit this link:
http://rotter.net/israel

Attachment: pgpr1QLEIrDXf.pgp
Description: PGP signature