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?
- 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.
I hope this helps.
Garth
···
On 12/12/11 11:10, Glenn wrote:
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?
[here on a Mac]
$ program/soffice --help
...
-p <documents...>
print the specified documents on the default printer.
--pt <printer> <documents...>
print the specified documents on the specified printer.
Haven't tested this; you might also want --invisible or --headless.
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.
···
On Mon, Dec 12, 2011 at 12:40 AM, Glenn <glenn_ritz@yahoo.com> wrote:
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?
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.
···
On 12/12/11 11:24, Garthy D wrote:
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.
I hope this helps.
Garth
On 12/12/11 11:10, Glenn wrote:
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?