Send rtf files to printer

Hi,

I have a hundred or so rtf files and I need to print them. I’d like to
use Ruby to do this. My guess is that I’ll have to open MS Word – the
only word processor that I have available where I work – and send the
rtf file to the printer through Word. But maybe there’s a better way to
do this?

Any suggestions would be appreciated.

Thanks!

Glenn

Hi Glenn,

Some options:

  • Google “batch print rtf”.
  • More directly relating to Ruby: Google “ruby automate word” (this is
    probably your best bet).

If these don’t suffice, AutoIT is good for driving generic Windows GUIs.
I’ve also used Ruby to drive AutoIT before. It took a bit of messing
about to get working how I wanted it, but it was extremely useful once
working. I used this setup for mass installs on different machines in a
short time window when a GUI install was the only viable option.

It’s been a while since I’ve played with this sort of stuff, but most of
the resources from the searches above look good. :slight_smile:

I hope this helps.

Garth

Oh, I almost forgot: A good starting point is to look into the Ruby
library Win32OLE. You can do all sorts of fun things with it. :slight_smile:

Glenn R. wrote in post #1036214:

Any suggestions would be appreciated.

libreoffice?

[here on a Mac]
$ program/soffice --help

-p <documents…>
print the specified documents on the default printer.
–pt <documents…>
print the specified documents on the specified printer.

Haven’t tested this; you might also want --invisible or --headless.

On Mon, Dec 12, 2011 at 12:40 AM, Glenn [email protected] wrote:

Rautomation GitHub - jarmo/RAutomation: RAutomation is a nice little
windows
automation library in Ruby. I have used in the past to get some fairly
funky results (internal browser windows in chrome). Might be just the
ticket for automating word.

Also there is the Win32OLE api as well, that was mentioned.