From: jamesvtoomey@... (James Toomey) Date: 2002-10-24T09:02:15+09:00 Subject: Re: Ruby and Windows "Regina Goodwin" wrote in message news:... > When I open up Ruby on my Windows Desktop and I write code, how do I get it > to compile? I am new to Ruby and programming. > > Help There's no need to compile it because it's a script language. The Ruby files work just like VBScript files; you can just write your script using Notepad, save the file with a ".rb" extension, and double-click it to run it. I'm also using Ruby with Windows, and I'm fairly inexperienced at it, so I feel your pain because I went through your confusion at the beginning. Have you already downloaded and run the Ruby for Windows installation? You should be able to click "Start>Programs>Ruby" and see a number of programs, like "Interactive Ruby Shell," "RubyBook Help," and "RubyWin." If you don't even see that, then you need to download the installation and run it. Here's one place to get it: http://www.s-direktnet.de/homepages/neumann/rb_prgs/ If you do have Ruby installed and you can see those programs, I found the easiest place to start learning Ruby is the "RubyWin" program. Click Start>Programs>Ruby>RubyWin to start the RubyWin program. You can use this program to write and run your Ruby scripts. For example, let's say you've written a Ruby script and saved it as an *.rb file, and now you want to run it. To do so, click Ruby>Run File and browse to the file, then click Open and the script will be run. If there are errors, you'll be able to see the errors that are occurring. You can now open that file with File>Open, fix the errors and save the file, then click Ruby>Run File and browse to the file again to re-run it. You can also double-click on an *.rb file directly and it will run, because the Ruby installation makes an association with the ".rb" file extension. However, if your Ruby code just does something like write the word "test" back to the screen (for example, if your Ruby script just has this one line of code: puts 'test'), then you'll just see a momentary flash as the Ruby shell quickly opens, runs, and closes. It can be confusing because it seems like nothing's happening. Also, if there are errors, you won't be able to read them because the shell closes right away. That's why I find it better to run files using the RubyWin program. Here's a basic example that shows how a Ruby script can actually do things like create Windows files. Try putting these two lines in a text file and save the file with the name test.rb: aFile=File.new("c:\\temp\\test.txt", "w") aFile.close When you double-click on the "test.rb" file, it should create the "test.txt" file in your temp directory.