Problem piping *.doc attachment to AbiWord.
I have antiword set up as my mailcap entry for viewing MSWord docs and it works great (thanks Sven :). What I'd also like to do, from time to time, is pipe a *.doc to AbiWord. From the attachment menu, I've tried: | AbiWord and | AbiWord %s and | AbiWord %s Version one opens AbiWord without the file. Versions two and three open AbiWord with an error message saying, unable to open file %s. I've used AbiWord successfully in my mailcap file, using the %s temporary file descriptor, FWIW. I've looked at pipe_split, pipe_decode and pipe_sep, but none of them seem on point for what I'm trying to do. AbiWord documentation sheds no light on this, that I could find. Surely this is a brain cramp on my part, but any help appreciated. Thanks. John
Re: Problem piping *.doc attachment to AbiWord.
On Wed, Jul 10, 2002 at 10:40:16AM -0400, John P Verel wrote: I have antiword set up as my mailcap entry for viewing MSWord docs and it works great (thanks Sven :). What I'd also like to do, from time to time, is pipe a *.doc to AbiWord. The problem is that piping and opening attachments work via different mechanisms. Piping uses the UNIX concept of pipes, which is where it gets its name, and you can't pipe to AbiWord. While many UNIX commands are written to operate as a filter - reading from their standard input instead of from a named file - AbiWord is not. When you open an attachment, the attachment first gets saved to a file on disk with some temporary name (like /tmp/foo.doc). In the command from your mailcap, %s is then replaced with that filename before the command is executed. So what ends up being run is, for example, this: abiword /tmp/foo.doc But when you pipe to a command, the attachment isn't saved first. Mutt just runs the command and then sends the data to it on its standard input. It's as if you had typed just the command with no arguments: abiword and then started typing the contents of the attachment on your keyboard. If you try to pipe to abiword %s then it just runs that command literally, and abiword tries to open a file named '%s' and can't find it. Like you, I have antiword set up for everyday .doc reading, and fire up AbiWord when antiword isn't enough. But I just save the attachment and then run abiword on it: s filename !abiword filename -- Mark REED| CNN Internet Technology 1 CNN Center Rm SW0831G | [EMAIL PROTECTED] Atlanta, GA 30348 USA | +1 404 827 4754 -- I can give you my word, but I know what it's worth and you don't. -- Nero Wolfe, Over My Dead Body
Re: Problem piping *.doc attachment to AbiWord.
On 07/10/02 10:51 -0400, Mark J. Reed wrote: Like you, I have antiword set up for everyday .doc reading, and fire up AbiWord when antiword isn't enough. But I just save the attachment and then run abiword on it: s filename !abiword filename Yep, that works fine. Just looking for a shortcut. I suppose one could construct a macro to do the above, right? John
Re: Problem piping *.doc attachment to AbiWord.
On Wed, Jul 10, 2002 at 11:30:09AM -0400, John P Verel wrote: s filename !abiword filename Yep, that works fine. Just looking for a shortcut. I suppose one could construct a macro to do the above, right? Sure, something like this should do the trick: macro attach a s/tmp/foo.doc\r!abiwordSpace/tmp/foo.doc\r Then just hit a to open an attachment up in Abiword. -- Mark REED| CNN Internet Technology 1 CNN Center Rm SW0831G | [EMAIL PROTECTED] Atlanta, GA 30348 USA | +1 404 827 4754 -- They will only cause the lower classes to move about needlessly. -- The Duke of Wellington, on early steam railroads.
Re: Problem piping *.doc attachment to AbiWord.
On 07/10/02 11:37 -0400, Mark J. Reed wrote: macro attach a s/tmp/foo.doc\r!abiwordSpace/tmp/foo.doc\r Almost. I got this to work: macro attach a save-entry\cubol~/tmp/foo.doc\n!AbiWord ~/tmp/foo.doc\n Without ^U, the original name of the attachment was being appended to foo.doc. The bol is just insurance. Also, AbiWord is case sensitive. Your macro has \r in two places. What the intent there? Time for lunch. After lunch, I'll amend the macro to delete the temp file. Regards, John
Re: Problem piping *.doc attachment to AbiWord.
On Wed, Jul 10, 2002 at 12:23:35PM -0400, John P Verel wrote: On 07/10/02 11:37 -0400, Mark J. Reed wrote: macro attach a s/tmp/foo.doc\r!abiwordSpace/tmp/foo.doc\r Almost. Sorry. My version worked fine on my system. I got this to work: macro attach a save-entry\cubol~/tmp/foo.doc\n!AbiWord ~/tmp/foo.doc\n Without ^U, the original name of the attachment was being appended to foo.doc. Ah, could be. The attachment I tested it on had no filename in its Content-Disposition. The bol is just insurance. Also, AbiWord is case sensitive. Okay. When I installed AbiWord, it created both 'abiword' and 'AbiWord' links. Your macro has \r in two places. What the intent there? Carriage return. \n works too, since you can hit control-J instead of Enter, but since the key I actually hit is Enter and it sends a carriage return, that's what I use in my macros. Time for lunch. After lunch, I'll amend the macro to delete the temp file. Yeah, I almost replied to my own message to add that, but decided it wasn't worth another message in the thread. :) -- Mark REED| CNN Internet Technology 1 CNN Center Rm SW0831G | [EMAIL PROTECTED] Atlanta, GA 30348 USA | +1 404 827 4754 -- Swap read error. You lose your mind.
Re: Problem piping *.doc attachment to AbiWord: Deleting the temp file
On 07/10/02 12:23 -0400, John P Verel wrote: Time for lunch. After lunch, I'll amend the macro to delete the temp file. This seems trivial, but I can't get the macro to do this. If I do rm -f foo.doc, I get dumped into my editor. I also can't figure out how to a) have AbiWord execute and then b) execute the rm after AbiWord exits. John
Re: Problem piping *.doc attachment to AbiWord: Deleting the temp file
On 07/10/02 14:52 -0400, Mark J. Reed wrote: Mutt should hang around and do nothing until AbiWord exits, so you should be able to just append a !rm -f ~/tmp/foo.doc\n to your macro. . . Arrrggh! Forgot the ! Finished product looks like this and works just fine. macro attach a save-entry\cubol~/tmp/foo.doc\n;!AbiWord ~/tmp/foo.doc\n;!rm -f ~/tmp/foo.doc\n John