Re: Run command on an attachment
Thanks all! Script + mailcap does it nicely! -- Salve
Re: Run command on an attachment
* On 28 Feb 2013, Richard wrote: > On Wed, Feb 27, 2013 at 08:14:13PM +0100, Salve Håkedal wrote: > > > > Is it possible to scp an attachment directly from mutt? > > should be doable with mailcap This is the approach I would take, too. Rather than trying to move the attachment and open it elsewhere, make moving the attachment part of opening it locally, via mailcap. You could make a script called "remoteopen" that scps the file and uses a remote mailcap to open it, then use remoteopen as the local mailcap handler. -- David Champion • d...@bikeshed.us
Re: Run command on an attachment
On Wed, Feb 27, 2013 at 08:14:13PM +0100, Salve Håkedal wrote: > My main machine don't have openoffice or similar installed, but > sometimes I need to use openoffice on an attachment. I now do that by > scp-ing files to that machine and then ssh -X into that machine. > > To scp an attachment to the other machine, I first save it from the > attachment menu. I'd like to skip this step. > > Is it possible to scp an attachment directly from mutt? should be doable with mailcap Richard --- Name and OpenPGP keys available from pgp key servers
Re: Run command on an attachment
Dear Salve, Thomas, On Wed, Feb 27, 2013 at 08:36:44PM +0100, Thomas Wallrafen wrote: > Hello once more, > > On Wed, Feb 27, 2013 at 08:28:43PM +0100, Thomas Wallrafen wrote: > > Hej, > > > > On Wed, Feb 27, 2013 at 08:14:13PM +0100, Salve Håkedal wrote: > > > ... > > > Is it possible to scp an attachment directly from mutt? > > A short time ago I posted here a small script which may be useful to run arbitrary commands on arbitrary attachments. I put the cursor on the desired attachment and tipe: | muttfilter filename program [arguments ...] where filename is the name with which you want to save the attachment (maybe temporarily) and program is the program or script you want to run on that file. The arguments are optional. Maybe it can be useful to run the script that copies to the other machine and runs openoffice, etc. You could have a different script for each required file type The script is: #!/bin/bash # muttfilter # to filter from mutt #first copy standard in to regular file giving some name # then open with some program using some arguments #Usage muttfilter name program args cat - > $1 # Then run command with given arguments on filename $2 ${@:3} $1 > > Well, you could try at least something like below: > > > > macro attach ,p 'ssh -X user@remotehost "cat - > ~/out.odt; > > oowriter ~/out.odt" > > > > So you can type ,p upon the attachment and get it opened on the remote > > host. > > > > Obvious drawback is the hard coded program on the remote host - but > > that should be easily replacable by sth acting dependent upon the file > > extension. > > ok, the latter was rubbish because afaik you will not be able to set > the file name on the remote host dynamically. However, you could still > (a) define one macro per file extension or (b) try to use file(1) to > invoke the right program. > > bye, > > thomas -- o W. Luis Mochán, | tel:(52)(777)329-1734 /<(*) Instituto de Ciencias Físicas, UNAM | fax:(52)(777)317-5388 `>/ /\ Apdo. Postal 48-3, 62251 | (*)/\/ \ Cuernavaca, Morelos, México | moc...@fis.unam.mx /\_/\__/ GPG: DD344B85, 2ADC B65A 5499 C2D3 4A3B 93F3 AE20 0F5E DD34 4B85
Re: Run command on an attachment
Hello once more, On Wed, Feb 27, 2013 at 08:28:43PM +0100, Thomas Wallrafen wrote: > Hej, > > On Wed, Feb 27, 2013 at 08:14:13PM +0100, Salve Håkedal wrote: > > My main machine don't have openoffice or similar installed, but > > sometimes I need to use openoffice on an attachment. I now do that by > > scp-ing files to that machine and then ssh -X into that machine. > > > > To scp an attachment to the other machine, I first save it from the > > attachment menu. I'd like to skip this step. > > > > Is it possible to scp an attachment directly from mutt? > > Well, you could try at least something like below: > > macro attach ,p 'ssh -X user@remotehost "cat - > ~/out.odt; > oowriter ~/out.odt" > > So you can type ,p upon the attachment and get it opened on the remote > host. > > Obvious drawback is the hard coded program on the remote host - but > that should be easily replacable by sth acting dependent upon the file > extension. ok, the latter was rubbish because afaik you will not be able to set the file name on the remote host dynamically. However, you could still (a) define one macro per file extension or (b) try to use file(1) to invoke the right program. bye, thomas
Re: Run command on an attachment
Hej, On Wed, Feb 27, 2013 at 08:14:13PM +0100, Salve Håkedal wrote: > My main machine don't have openoffice or similar installed, but > sometimes I need to use openoffice on an attachment. I now do that by > scp-ing files to that machine and then ssh -X into that machine. > > To scp an attachment to the other machine, I first save it from the > attachment menu. I'd like to skip this step. > > Is it possible to scp an attachment directly from mutt? Well, you could try at least something like below: macro attach ,p 'ssh -X user@remotehost "cat - > ~/out.odt; oowriter ~/out.odt" So you can type ,p upon the attachment and get it opened on the remote host. Obvious drawback is the hard coded program on the remote host - but that should be easily replacable by sth acting dependent upon the file extension. hth, thomas
Run command on an attachment
My main machine don't have openoffice or similar installed, but sometimes I need to use openoffice on an attachment. I now do that by scp-ing files to that machine and then ssh -X into that machine. To scp an attachment to the other machine, I first save it from the attachment menu. I'd like to skip this step. Is it possible to scp an attachment directly from mutt? -- Salve