interact with Ruby via command prompt window dynamically

L

Li Chen

Hi all,

I use SciTE for Ruby scripting. I wonder if it is possible to
dynamically interact with my script via command prompt from within
SciTE. For example I want to get user input and then print it to the
command prompt window.

//script
input=STDIN.gets
puts input

It works if I execute the script from a prompt window but doesn't work
via SciTE. I wonder what is the Ruby way to interact with the user from
the command prompt window.

Thanks,

Li
 
S

Stefan Mahlitz

Li said:
Hi all,

I use SciTE for Ruby scripting. I wonder if it is possible to
dynamically interact with my script via command prompt from within
SciTE. For example I want to get user input and then print it to the
command prompt window.

//script
input=STDIN.gets
puts input

It works if I execute the script from a prompt window but doesn't work
via SciTE. I wonder what is the Ruby way to interact with the user from
the command prompt window.

It does work for me.
print("Enter some text: ")
$stdout.flush
input = gets
puts("You entered <#{input}>")

Running in SciTE it open a cmd prompt (where the ruby interpreter is
called).

Output goes to SciTE-output pane - so you can ignore the cmd-window.
Just switch back to SciTE to enter the data and see the output.

I did use the output-pane for entering the data.

Stefan
 

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,744
Messages
2,569,483
Members
44,902
Latest member
Elena68X5

Latest Threads

Top