From: James on
>
> Thank you all for your input. After reading the comments I took the
> advice of reading the two on-line tutorials, so this is where I am now:
> I have switched to a different computer that has the Windows XP
> operating system, have installed Ruby 1.9.1 on it (with ruby.exe located
> in ‘C:\Ruby191\bin’), I downloaded and installed the SciTE editor
> recommended by Mr. Neighborly’s Humble Little Ruby Book, and have been
> successful in getting the SciTE editor to open scripts located in
> ‘C:\Documents and Settings\Karl Halvorson\My Documents\Ruby\My Ruby
> Tutorial scripts’. The tutorials with this editor started out fine, I
> entered the text
>
> puts "Hello, World."
>
> Into the text editor, pressed go and got
>
> >ruby hello.rb
> Hello, World.
> >Exit code: 0
>
> To me that looked like it worked the way it was supposed to.
>

Looks that way here, too. Good work!



> I then went on to the next step and typed the following into the text
> editor:
>
> puts "Hello, World. What is your name?"
> myname = gets()
> puts "Well, hello there " + myname + "."
>
> I was instructed to save the file again, so I did, as hello2.rb, and ran
> it again from the editor by pressing go. What I returned in the right
> pane of the editor was:
>
> >ruby hello2.rb
>
> Also, the Windows Command Prompt opened up with
> ‘C:\Ruby191\bin\ruby.exe’ at the top in the menu bar, but nothing in the
> black screen except for a blinking cursor (see attached image1). I tried
> typing in the black screen, but was unable to. The tutorial stated, “you
> should see a greeting, be asked for your name, and then greeted by
> name.” None of this happened.
>
> Any suggestions what to try next?
>
>
Sure thing. I ran your code and saw the same output. So you're doing
everything right, this is something with scite. I have no real idea what's
happening to make the process hang, but a little research shows that it's
related to the call to gets, and further research shows that this is a known
problem with scite.

There's a solution, though! Running the script from the command prompt will
work fine.

StartMenu -> All Programs -> Ruby191 -> "Start Command Prompt with Ruby"
cd "C:\Documents and Settings\Karl Halvorson\My Documents\Ruby\My
Ruby Tutorial scripts"

Now run the script using ruby! Type:
ruby "name of script"



> Also, Phaneee5, could you explain, in beginner language (step-by-step)
> what you mean by “Setting the PATH environment variable to the ruby->bin
> folder”, for this is not covered in any of the biginning tutorials that
> I have read? The part I really don’t understand is “Add this path to the
> PATH environment variable.” The path to ruby.exe on my computer is
> ‘C:\Ruby191\bin’, but what exactly is the ‘PATH environment variable’?
> and how exactly do I add ‘C:\Ruby191\bin’ to it?
>
> Thank you all again for your help.
>
>
http://support.microsoft.com/kb/310519 discusses environment variables,
including the PATH. With the ruby windows installer, you get the shortcut
that we used above to start a command prompt with the right environment for
using ruby. However, if you want you set up your environment so that it's
always correct for running ruby from the command line, so that you can use a
regular command prompt to run ruby programs instead of needing to use the
specific shortcut that the installer gave you.

From: Karl Halvorson on
Thanks James!

The scripts are working from 'Start Comand Promp with Ruby' as you
instructed. I think the problem with the command prompt before was not
first switching to the directory where the .rb files are located. I
think it is odd that the three or more tutorials that I have looked at
do not mention this.

Thanks again for all your help.

James wrote:
>> entered the text
>>
> Looks that way here, too. Good work!
>
>
>
>>
>>
>>
> Sure thing. I ran your code and saw the same output. So you're doing
> everything right, this is something with scite. I have no real idea
> what's
> happening to make the process hang, but a little research shows that
> it's
> related to the call to gets, and further research shows that this is a
> known
> problem with scite.
>
> There's a solution, though! Running the script from the command prompt
> will
> work fine.
>
> StartMenu -> All Programs -> Ruby191 -> "Start Command Prompt with Ruby"
> cd "C:\Documents and Settings\Karl Halvorson\My Documents\Ruby\My
> Ruby Tutorial scripts"
>
> Now run the script using ruby! Type:
> ruby "name of script"
>
>
>
>>
> http://support.microsoft.com/kb/310519 discusses environment variables,
> including the PATH. With the ruby windows installer, you get the
> shortcut
> that we used above to start a command prompt with the right environment
> for
> using ruby. However, if you want you set up your environment so that
> it's
> always correct for running ruby from the command line, so that you can
> use a
> regular command prompt to run ruby programs instead of needing to use
> the
> specific shortcut that the installer gave you.

--
Posted via http://www.ruby-forum.com/.

First  |  Prev  | 
Pages: 1 2
Prev: broken UTF-8 string
Next: [ANN] DIFECTS 3.0.0