Thanks! That helped!

BTW It turned out that a major obstacle in getting _anythong_ to work, was 
that I tried to execute the code form inside RubyWin. So, programs with 
shell commands should be run from the shell prompt in order to work at all! 
While that might be obious to many, that depends on the backgorund. WIndows 
automation should be an obvious first thing to do for many new Rubiers. I 
find it very hard, with sparse and scattered docs. I think the PickAxe book 
is really great, even Python hasn't got help accsess that easyly aviable! 
But in the areas where the PickAxe doesn't say much (like unicode encoding 
and windows atomation) then it's another world. I miss some hands-on HOWTO's!

Regards Henning




-----------------------------
At 16:40 2002-05-17 +0900, you wrote:
>On Fri, 17 May 2002, Henning von Rosen wrote:
>
> > How do I accomplish the simple invocation from a ruby script of a program
> > that I normally start from the DOS prompt.
> > The backslash doesn't work, and I don't get the workarounds mantiond for
> > shell commands to work, or is that not the same thing?
> >
> > I feel really newbie-ish about this, and I really need it to work very
> > soon. Hints/links apprechiated. I'v got 10000 images to vectorize, doing it
> > by hand won't do any good. Doing it with Ruby would be nice.
> >
> > amike via Henning
> >
>
>
>I use...
>     def cmd( *args)
>       dosArgs = Array.new
>       dosArgs.push args.shift # Get the command...
>       args.each do |arg|
>         if arg =~ %r{^/} then #its an option...
>           dosArgs.push arg
>         else
>           dosArgs.push dosish( arg)
>         end
>       end
>       @log.puts 'CMD> ' + dosArgs.join(' ')
>       dosArgs.unshift('/c')
>       dosArgs.unshift('cmd')
>       system( *dosArgs)
>     end
>
>     def dosish( dir)
>       dir.gsub( %r{/}, '\\')
>     end
>
>Does a couple of other nifty things like convert unixish / to dosish \ in
>filenames and writes a log of what it is up to @log.
>
>
>John Carter                             Phone : (64)(3) 358 6639
>Tait Electronics                        Fax   : (64)(3) 359 4632
>PO Box 1645 Christchurch                Email : john.carter / tait.co.nz
>New Zealand
>
>May contain traces of nuts. This email was packed by mass, not
>volume. Contents may have settled during distribution.
>This email is not designed or intended for use in on-line control of
>aircraft, air traffic, aircraft navigation or aircraft communications; or in
>the design, construction, operation or maintenance of any nuclear
>facility. Reader represents and warrants that it will not use or
>redistribute the email for such purposes.