[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

rubyw.exe doesn't respond, ver 1.8.2-15 on WinXP

RichardOnRails

7/3/2006 10:22:00 PM

Hi,

I can't get a window to open when I double-click an HellowWorld.rbx
file. But if I run the same file under SciTE, it works fine (and no
extraneous Command window pops up).

I checked the file association: RBW maps to "Ruby program (no window)"
However, the Details say "Opens with Ruby interpreter"

I tried running HelloWorld.rbx with Rubyw.exe in a Command window, but
no window was opened.

I thought maybe a window opened and closed so rapidly, so I added "s =
''" and a "gets s"
That ran fine under Ruby.exe in a Command window: It didn't return a
prompt until I hit Ctrl-C.
But using RubyW.exe in the Command window did nothing; likewise
double-clicking it.

Any ideas?

TIA,
Richard

7 Answers

Kenosis

7/3/2006 10:30:00 PM

0

What's the behavior you want? Run a .rb file on Windows and you get a
command shell within which is run the ruby process that executes your
scipt. Run it with rubyw.exe and its run w/out a Windows command shell
"wrapping" it, that's why you see no extraneous window (or so I
understand it.) I'd guess therefore that your .rbx files are
associated w/rubyw.exe. As for why SciTE does what you expect, I
suppose that's coincidence. Again, what behavior do you want and
perhaps someone can help you get that :)

Cheers,

Ken

Richard wrote:
> Hi,
>
> I can't get a window to open when I double-click an HellowWorld.rbx
> file. But if I run the same file under SciTE, it works fine (and no
> extraneous Command window pops up).
>
> I checked the file association: RBW maps to "Ruby program (no window)"
> However, the Details say "Opens with Ruby interpreter"
>
> I tried running HelloWorld.rbx with Rubyw.exe in a Command window, but
> no window was opened.
>
> I thought maybe a window opened and closed so rapidly, so I added "s =
> ''" and a "gets s"
> That ran fine under Ruby.exe in a Command window: It didn't return a
> prompt until I hit Ctrl-C.
> But using RubyW.exe in the Command window did nothing; likewise
> double-clicking it.
>
> Any ideas?
>
> TIA,
> Richard

RichardOnRails

7/3/2006 10:32:00 PM

0

Hi Again,

I should mention that I just ran the file:

# P002-For-in_loop.rbw
for i in 1..5
puts "Hello, World ##{i}!"
end

under SciTE and got in the output frame:

>rubyw P002-For-in_loop.rbw
Hello, World #1!
Hello, World #2!
Hello, World #3!
Hello, World #4!
Hello, World #5!
>Exit code: 0

So rubyw runs fine for SciTE, so I must be doing making a few
mistakes.

Regards,
Richard

RichardOnRails

7/3/2006 10:41:00 PM

0

Hi Ken,

Thanks for your response. I expected a window to open and the "Hellow,
World!" string to be displayed in it. I must be all wet about this. I
quickly checked the PickAxe 2nd Ed. and Fulton's Ruby Way and didn't
see anything relevant. I'm going to search the Web for info on this.

Regards,
Richard


Kenosis wrote:
> What's the behavior you want? Run a .rb file on Windows and you get a
> command shell within which is run the ruby process that executes your
> scipt. Run it with rubyw.exe and its run w/out a Windows command shell
> "wrapping" it, that's why you see no extraneous window (or so I
> understand it.) I'd guess therefore that your .rbx files are
> associated w/rubyw.exe. As for why SciTE does what you expect, I
> suppose that's coincidence. Again, what behavior do you want and
> perhaps someone can help you get that :)
>
> Cheers,
>
> Ken
>
> Richard wrote:
> > Hi,
> >
> > I can't get a window to open when I double-click an HellowWorld.rbx
> > file. But if I run the same file under SciTE, it works fine (and no
> > extraneous Command window pops up).
> >
> > I checked the file association: RBW maps to "Ruby program (no window)"
> > However, the Details say "Opens with Ruby interpreter"
> >
> > I tried running HelloWorld.rbx with Rubyw.exe in a Command window, but
> > no window was opened.
> >
> > I thought maybe a window opened and closed so rapidly, so I added "s =
> > ''" and a "gets s"
> > That ran fine under Ruby.exe in a Command window: It didn't return a
> > prompt until I hit Ctrl-C.
> > But using RubyW.exe in the Command window did nothing; likewise
> > double-clicking it.
> >
> > Any ideas?
> >
> > TIA,
> > Richard

Kenosis

7/3/2006 10:45:00 PM

0

Well, I may not be helping much here but when you run a process, such
as ruby on a script, "someone" needs to provide for stdin and stdout,
which would be a command shell most commonly. Otherwise, when you
launch the ruby process you'd have to specify via I/O redirection, ie,
'<' & '>' where ruby should obtain input and output from. It stands to
reason that SciTE is handling that for you, capturing you standard
output and displaying that in its output frame. So, back to my
original question: what behavior are you looking for when you launch a
..rbx file?

Ken

Richard wrote:
> Hi Again,
>
> I should mention that I just ran the file:
>
> # P002-For-in_loop.rbw
> for i in 1..5
> puts "Hello, World ##{i}!"
> end
>
> under SciTE and got in the output frame:
>
> >rubyw P002-For-in_loop.rbw
> Hello, World #1!
> Hello, World #2!
> Hello, World #3!
> Hello, World #4!
> Hello, World #5!
> >Exit code: 0
>
> So rubyw runs fine for SciTE, so I must be doing making a few
> mistakes.
>
> Regards,
> Richard

Kenosis

7/3/2006 10:49:00 PM

0

Well, then it seems to be that you'll need to triple check that .rbx
files are associated w/ruby.exe rather than rubyw.exe so you'll get the
command shell launched which would display your output. You may need
to place a STDIN.get at the end of the script to ensure the command
shell window stays open so you can see the output; perhaps adding a
STDOUT.flush before that to ensure the buffer is displayed.

Ken

Richard wrote:
> Hi Ken,
>
> Thanks for your response. I expected a window to open and the "Hellow,
> World!" string to be displayed in it. I must be all wet about this. I
> quickly checked the PickAxe 2nd Ed. and Fulton's Ruby Way and didn't
> see anything relevant. I'm going to search the Web for info on this.
>
> Regards,
> Richard
>
>
> Kenosis wrote:
> > What's the behavior you want? Run a .rb file on Windows and you get a
> > command shell within which is run the ruby process that executes your
> > scipt. Run it with rubyw.exe and its run w/out a Windows command shell
> > "wrapping" it, that's why you see no extraneous window (or so I
> > understand it.) I'd guess therefore that your .rbx files are
> > associated w/rubyw.exe. As for why SciTE does what you expect, I
> > suppose that's coincidence. Again, what behavior do you want and
> > perhaps someone can help you get that :)
> >
> > Cheers,
> >
> > Ken
> >
> > Richard wrote:
> > > Hi,
> > >
> > > I can't get a window to open when I double-click an HellowWorld.rbx
> > > file. But if I run the same file under SciTE, it works fine (and no
> > > extraneous Command window pops up).
> > >
> > > I checked the file association: RBW maps to "Ruby program (no window)"
> > > However, the Details say "Opens with Ruby interpreter"
> > >
> > > I tried running HelloWorld.rbx with Rubyw.exe in a Command window, but
> > > no window was opened.
> > >
> > > I thought maybe a window opened and closed so rapidly, so I added "s =
> > > ''" and a "gets s"
> > > That ran fine under Ruby.exe in a Command window: It didn't return a
> > > prompt until I hit Ctrl-C.
> > > But using RubyW.exe in the Command window did nothing; likewise
> > > double-clicking it.
> > >
> > > Any ideas?
> > >
> > > TIA,
> > > Richard

RichardOnRails

7/3/2006 10:53:00 PM

0

Hi All,

OK, I found some comments on the Web that shed light on this. It
appears that rubyw.exe is for running programs that will use the
Windows API directly, or indirectly through FxRuby or even more
indirectly by Ruby on Rails. I imagine SciTE uses the Windows API to
produce its output.

Sorry for wasting your time.

Regards,
Richard

RichardOnRails

7/3/2006 11:24:00 PM

0

Hi All,

OK, I've confirmed Rubyw.exe and double-clicking an .rbw file is
working fine on my system.

And Ken: thanks for hanging in there with me.

I haven't used Ruby, and more particularly, with graphics, in several
years. So I was having brain cramps. But I discovered examples I ran
a few years ago. Here's one:

============ GraphicsTest.rbw ===========
#!/usr/bin/ruby

require 'rubygems'
require 'gruff'

g = Gruff::Line.new
g.title = "My Graph"

g.data("Apples", [1, 2, 3, 4, 4, 3])
g.data("Oranges", [4, 8, 7, 9, 8, 9])
g.data("Watermelon", [2, 3, 1, 5, 6, 8])
g.data("Peaches", [9, 9, 10, 8, 7, 9])

g.labels = {0 => '2003', 2 => '2004', 4 => '2005'}

g.write('my_fruity_graph.png')
============ end ====================

When I double-clicked it, I got the "my...png" file, and when I
double-clicked the .png, I got a beautiful graph displayed by
Microsoft Office Picture Manager.

So, my original question is now answered: there's no problem on my
system. Now I've got to re-learn how to use Rails.

Cheers,
Richard