running ruby

Y

yahdoco

Hi Everyone...I am a very new ruby user. I have downloaded ruby to my
computer (windows98). I have a ruby icon on my desktop with the name
hello. In the notepad part of the icon (hello.rb) are the following
words:

#generate some simple output (comment)
puts "Hello World"

When I click on the icon, a small screen appears with the name ruby.
The screen in visible for a few seconds. Then it disappears. The
screen is black and the words on it are white. I can't read the words
because the screen disappears too quickly.

How can I make the screen stay visible until I choose to click it off?
How can I change the screen so that the words are in black letters on
a white background?

Thanks for your help. Yahdoco
 
L

Lloyd Linklater

yahdoco said:
How can I make the screen stay visible until I choose to click it off?
How can I change the screen so that the words are in black letters on
a white background?

Hiya!

What about adding a gets at the end?
 
K

Konrad Meyer

--nextPart2695735.SYj1zCBYoK
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

Hi Everyone...I am a very new ruby user. I have downloaded ruby to my
computer (windows98). I have a ruby icon on my desktop with the name
hello. In the notepad part of the icon (hello.rb) are the following
words:
=20
#generate some simple output (comment)
puts "Hello World"
=20
When I click on the icon, a small screen appears with the name ruby.
The screen in visible for a few seconds. Then it disappears. The
screen is black and the words on it are white. I can't read the words
because the screen disappears too quickly.
=20
How can I make the screen stay visible until I choose to click it off?
How can I change the screen so that the words are in black letters on
a white background?
=20
Thanks for your help. Yahdoco

Go to the start menu > Run, and type "cmd" (sans quotation marks). This
should open a command prompt you can use to run it ("ruby hello.rb").

Hope it helps,

=2D-=20
Konrad Meyer <[email protected]> http://konrad.sobertillnoon.com/

--nextPart2695735.SYj1zCBYoK
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBG3ag9CHB0oCiR2cwRAts7AKDQzmfeCwR1u5aT7WBoCZ+LjrnX0QCfaMyV
CHxD+DdcUMktbm2p6MvW3v0=
=5uDS
-----END PGP SIGNATURE-----

--nextPart2695735.SYj1zCBYoK--
 
Y

yahdoco

I sill have the same two problems:
(1)The hello world screen disappears quickly.
(2)The letters are white on a black background.
I tried using MyComputer>ControlPanel>Display and the
DialogBox(Appearance) but nothing changed.
Any other ideas out there?
Thanks. Yahdoco
 
A

Alex Young

yahdoco said:
I sill have the same two problems:
(1)The hello world screen disappears quickly.
What have you tried? Can you post some code?
(2)The letters are white on a black background.
I tried using MyComputer>ControlPanel>Display and the
DialogBox(Appearance) but nothing changed.
Any other ideas out there?
Right click on the title bar of the console window, and select
Properties. Set the colours up on the Colors tab. I don't know if it's
possible to control this from Ruby - I'd expect it would be, but I've
never needed to...
 
K

Konrad Meyer

--nextPart2007423.UI07f7pajW
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

I sill have the same two problems:
(1)The hello world screen disappears quickly.
(2)The letters are white on a black background.
I tried using MyComputer>ControlPanel>Display and the
DialogBox(Appearance) but nothing changed.
Any other ideas out there?
Thanks. Yahdoco

Don't just type "hello.rb" in the run box. Type "cmd", and you get a command
prompt that *doesn't* go away quickly, as I told you in the first email.

=2D-=20
Konrad Meyer <[email protected]> http://konrad.sobertillnoon.com/

--nextPart2007423.UI07f7pajW
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBG3b69CHB0oCiR2cwRAt4FAJ4zjAZjiTsMamtm4F1wa8N0t0dQCwCfaavh
lxkQlxUcwVNuM28GyYct5gM=
=IV85
-----END PGP SIGNATURE-----

--nextPart2007423.UI07f7pajW--
 
P

Phil

-----Original Message-----
From: yahdoco [mailto:[email protected]]
Sent: Tuesday, September 04, 2007 10:15 PM
To: ruby-talk ML
Subject: Re: running ruby

I sill have the same two problems:
(1)The hello world screen disappears quickly.

This is your Command Prompt. You can open it via Run -> "cmd" in the box, or
via your Programs in Accessories (IIRC, it is there. It should have an icon
reading MS-DOS). Then, you'll have a command prompt in black with grayish
text, eagerly awaiting to do your bidding. Tell it to go to your desktop, by
typing in "cd c:\documents and settings\<put your user name here>\Desktop".
That should get you where you have placed your hello.rb file.

Once you are at the place you saved your hello.rb, just type "ruby
hello.rb", and you'll see the output of your command prompt.

If you cannot find your hello.rb, just type "irb" at the command prompt, and
you enter the interactive Ruby shell. You can experiment with Ruby there,
too.

Please note: I'm not sure about the place of your Desktop, since it has been
ages since I've worked with Windows 98.
 
T

Todd Benson

Don't just type "hello.rb" in the run box. Type "cmd", and you get a command
prompt that *doesn't* go away quickly, as I told you in the first email.

Actually, in W98, I believe the command is "command" not "cmd".

To the OP:

Most rubyists run their programs from the command line. But if you
truly want to double click on an icon to run a program, you'll need
two files.

If your hello.rb file is in c:\ruby, you will need to create a file on
your desktop (or wherever) containing this text: "ruby
c:\ruby\hello.rb %1", and then rename it to have a .cmd extension (not
tested, by the way, since I don't have W98).

hth,

Todd
 
Y

yahdoco

Don't just type "hello.rb" in the run box. Type "cmd", and you get a command
prompt that *doesn't* go away quickly, as I told you in the first email.
------------------------------
I click on start>run and I get a dialog box with the word OPEN:
I enter the word cmd and I get an error Dialog Box with the words:
Cannot find tye file 'cmd' (or one of it's components). Make sure the
path and filename are correct and that all required libraries are
available.
The hello.rb program does not run.
It only runs when I enter "hello.rb", but the response (an active
window with the name ruby) come up and then quickly disappears.
Any other ideas? Thanks. Yahdoco
 
K

Konrad Meyer

--nextPart2224026.cScbbr5OYY
Content-Type: text/plain;
charset="iso-8859-1"
Content-Transfer-Encoding: quoted-printable
Content-Disposition: inline

------------------------------
I click on start>run and I get a dialog box with the word OPEN:
I enter the word cmd and I get an error Dialog Box with the words:
Cannot find tye file 'cmd' (or one of it's components). Make sure the
path and filename are correct and that all required libraries are
available.
The hello.rb program does not run.
It only runs when I enter "hello.rb", but the response (an active
window with the name ruby) come up and then quickly disappears.
Any other ideas? Thanks. Yahdoco

As Todd pointed out, the program to run in W98 is "command", not "cmd" --
you should try that. You should also probably get a newer operating system,
sheesh.

=2D-=20
Konrad Meyer <[email protected]> http://konrad.sobertillnoon.com/

--nextPart2224026.cScbbr5OYY
Content-Type: application/pgp-signature; name=signature.asc
Content-Description: This is a digitally signed message part.

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.7 (GNU/Linux)

iD8DBQBG3d3ICHB0oCiR2cwRAl6oAJ4+MjXhs8YPmz4A/AUvTDy3jDv3hQCguRzZ
/qFCmF+tOqA49qOaKdQQlQw=
=hyJF
-----END PGP SIGNATURE-----

--nextPart2224026.cScbbr5OYY--
 
N

Nobuyoshi Nakada

Hi,

At Wed, 5 Sep 2007 05:18:28 +0900,
Alex Young wrote in [ruby-talk:267595]:
Right click on the title bar of the console window, and select
Properties. Set the colours up on the Colors tab. I don't know if it's
possible to control this from Ruby - I'd expect it would be, but I've
never needed to...

I guess you can do it by setting the ColorTable## under the
registory key, \\HKEY_CURRENT_USER\Console. I don't know if
there are other ways.
 
A

Alex Young

Nobuyoshi said:
Hi,

At Wed, 5 Sep 2007 05:18:28 +0900,
Alex Young wrote in [ruby-talk:267595]:
Right click on the title bar of the console window, and select
Properties. Set the colours up on the Colors tab. I don't know if it's
possible to control this from Ruby - I'd expect it would be, but I've
never needed to...

I guess you can do it by setting the ColorTable## under the
registory key, \\HKEY_CURRENT_USER\Console. I don't know if
there are other ways.
I was thinking more along the lines of control codes. You can run
"color 70" at the command prompt, and that'll invert the colours
(documented here:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/cmd.mspx?mfr=true)
but I can't think how to do that from within a script running under that
shell.
 
Y

yahdoco

Hi Everyone...Something interesting happened yesterday when I turned
off my computer at the end of the day. After the desktop screen
disappeared, all of the ruby windows that appeared for a short time
and then disappeared were on the next screen. Apparently, by clicking
on the hello icon, I am sending the answer to the MSDOS WINDOOW(?)
behind the desktop.

(1)How do I make the response appear as a ruby window on top of my
desktop screen?
(2)How do I change this response so that it consists of black text on
a white screen?

Thanks for your help. I am going to review all of the messages I have
received so far an see what I can learn from them. Yahdoco
 
Y

yahdoco

Don't just type "hello.rb" in the run box. Type "cmd", and you get a command
Actually, in W98, I believe the command is "command" not "cmd".
---------------------------------
Hi Todd...You are correct. I took the following path:

START>
RUN>
Enter "command" and click on OK.

I got a window on my desktop>
Title=MS-DOS PROMPT
Content=C:\WINDOWS\Desktop>

At this point I tried words like:
run hello.rb
hello
hello.rb

but the message that came back was:

Bad Command

followed by C:\WINDOWS\Desktop>

What statement should I enter after Desktop>?

Thanks for your help. I seem to be learning new things and making a
lttle progress. Yahdoco
 
T

Todd Benson

---------------------------------
Hi Todd...You are correct. I took the following path:

START>
RUN>
Enter "command" and click on OK.

I got a window on my desktop>
Title=MS-DOS PROMPT
Content=C:\WINDOWS\Desktop>

At this point I tried words like:
run hello.rb
hello
hello.rb

but the message that came back was:

Bad Command

followed by C:\WINDOWS\Desktop>

What statement should I enter after Desktop>?

Thanks for your help. I seem to be learning new things and making a
lttle progress. Yahdoco

The run command is "ruby" :)

So, you would type:

ruby hello.rb

Just remember that when you are in the command prompt, you have to be
in the same directory as where your hello.rb file is. In this case,
you should be, because you are in c:\windows\Desktop which is the
directory (also known as folder) that holds the files that you see on
your real desktop.

Todd
 
A

Alex Young

Nobuyoshi said:
Hi,

At Wed, 5 Sep 2007 16:19:31 +0900,
Alex Young wrote in [ruby-talk:267699]:
I was thinking more along the lines of control codes. You can run
"color 70" at the command prompt, and that'll invert the colours
(documented here:
http://www.microsoft.com/resources/documentation/windows/xp/all/proddocs/en-us/cmd.mspx?mfr=true)
but I can't think how to do that from within a script running under that
shell.

system("color 70")
And there's me thinking that wouldn't work because it would execute in a
subshell... I guess I should try these things before writing them off :)
 
N

Nobuyoshi Nakada

Hi,

At Thu, 6 Sep 2007 16:53:26 +0900,
Alex Young wrote in [ruby-talk:267858]:
And there's me thinking that wouldn't work because it would execute in a
subshell... I guess I should try these things before writing them off :)

I'd tried it on Windows XP Home. Since a console isn't a
per-process resource, it works regardless which process did it.
 
Y

yahdoco

Hi Everyone...With the help of trial and error, I have made some
progress. I modified my hello.rb file by adding some ruby code that I
found on the web. The added code contained an analysis of a stock
using a yahoo website. (Actually, my interest in ruby is to do some of
my own stock market analysis). In the code was a request to enter a
stock symbol. This request kept the ruby window (with the "Hello
World" statement) on my desktop as it waited for me to enter a stock
symbol. Once I entered the symbol, a long calculation was made and
then the ruby window disappeared. Thus, one way to keep the window in
view is to add a request for input. I suppose a pause statement might
also work.

(1)Is there another way to keep the window in
view until I enter an exit command?

(2) I still have the problem that the window consists of white
characters on a black background. Is there a ruby command to change
the window or create another window with features that I can control?

Thanks for your help. Yahdoco
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,951
Messages
2,570,113
Members
46,698
Latest member
alexxx

Latest Threads

Top