On Tue, Jan 05, 2010 at 11:30:17PM -0500, Joseph Ishac wrote:
Since print_decode is set, mutt is parsing the message before piping it. I was wondering if there is a way to have mutt hand me the subject of the message so that I could pass it to the -t option of enscript to formulate a title.
I've attached my muttPrint script, which uses formail to grab the subject to pass to enscript.
Ed
#!/bin/sh # # muttPrint # # macro index,pager p \ # '<enter-command>source ~/.mutt/rc/print.rc<enter><pipe-message>muttPrint [enscript args]<enter>\ # <enter-command>source ~/.mutt/rc/unprint.rc<enter>' # arguments always passed to enscript args="-f Times-Roman12 --word-wrap --fancy-header=emacs-custom" # save the message to a tempfile : ${TEMP:=$HOME/tmp} tmpf=$TEMP/muttprint$$ cat >"$tmpf" # get Subject, stripping all occurrances of 'Re: ' and any initial spaces subj="$(formail -cx Subject <$tmpf | sed -e 's/Re: \?//g' -e 's/^\s\+//')" # get Date, and parse into a more regular, but still human-readable format date="$(date -d "$(formail -cx Date <$tmpf)" +%Y-%m-%d-%H:%M:%S)" # send message to print with appropriate title and all passed args enscript --title "$subj $date" $args "$@" <"$tmpf" # save the enscript return code, remove the temp file, and exit rc=$? rm "$tmpf" exit $rc
signature.txt
Description: Digital signature