Hello,
I would like to make Ruby run an external program - Maple - under Windows XP,
write something to it and then close it.
It would be nice to capture the output of that program, but that's not
obligatory, since I could make that program write a file for itself.
Following Hal Fulton's examples in "The Ruby Way", I tried two things without
success so far:
1.) Adapt
require "win32ole"
word = WIN32OLE.new "Word.Application"
word.visible = true
# ...
word.quit
2.) Adapt
require "open3"
filenames = %w[ file1 file2 this that another one_more ]
inp, out, err = Open3.popen3("xargs", "ls", "-l")
filenames.each { |f| inp.puts f } # Write to the process's stdin
inp.close # Close is necessary!
output = out.readlines # Read from its stdout
errout = err.readlines # Also read from its stderr
.
The problem seems to be that I do not really know how to tell
Ruby to start the right application - from the properties
menu I get the information that it's file
"C:\Programme\Maple 9.5\bin.win\maplew9.5.exe" that starts Maple,
but this is simply not recognized correctly.
Can anybody with Windows automation experience give me a hint how
to find out what to substitute for "Word.Application" in
word = WIN32OLE.new "Word.Application" in the first variant
or what to substitute for "xargs" in
inp, out, err = Open3.popen3("xargs", "ls", "-l")
?
Thank you,
Axel