Getting user input on windows

I’m new, please bear with me?

I am trying to get a bit of data from the user. The only library I’m
using now is watir (since I’m interacting w/ web pages). I can use get
or STDIN.read to grab the input, but I would like to do something like a
typical windows pop-up dialog box. Is there anything out there? If you
point me in the general direction I might be able to find it. I started
checking out the OLE stuff in hopes of finding it, but came back empty
handed.

Thank you!

edcrosbys wrote:

I’m new, please bear with me?

I am trying to get a bit of data from the user. The only library I’m
using now is watir (since I’m interacting w/ web pages). I can use get
or STDIN.read to grab the input, but I would like to do something like a
typical windows pop-up dialog box. Is there anything out there? If you
point me in the general direction I might be able to find it. I started
checking out the OLE stuff in hopes of finding it, but came back empty
handed.

Look for GUI toolkits. You have several options:
Tcl/Tk
Qt
GNOME
wxRuby

AFAIK, OLE doesn’t offer you the capabilities you need in this scenario.
Except, maybe, using a hack to leverage MSWord, but that isn’t exactly
the best of UIs. :wink:


Phillip “CynicalRyan” Gawlowski
http://cynicalryan.110mb.com/
http://clothred.rubyforge.org

Rule of Open-Source Programming #48:

The number of items on a project’s to-do list always grows or remains
constant.

On 4/26/07, Phillip G. [email protected] wrote:

Look for GUI toolkits. You have several options:
Tcl/Tk
Qt
GNOME
wxRuby

I’d also throw in a plug for FXRuby (http://www.fxruby.org/).

edcrosbys wrote:

I’m new, please bear with me?

I am trying to get a bit of data from the user. The only library I’m
using now is watir (since I’m interacting w/ web pages). I can use get
or STDIN.read to grab the input, but I would like to do something like a
typical windows pop-up dialog box. Is there anything out there? If you
point me in the general direction I might be able to find it. I started
checking out the OLE stuff in hopes of finding it, but came back empty
handed.

Thank you!

While you can use API calls to create a Yes/No message box, there
doesn’t appear to be a simple API means for creating a dialog for
accepting user string input.

As others have mentioned, you can use one of the GUI toolkits and, if
you have other GUI needs, this is the best option. If, however, the only
GUI need you have is for a single input dialog, you could use the
InputBox function from Excel, via the win32ole library (assuming Excel
is installed):

require ‘win32ole’

def get_input(prompt=’’, title=’’)
excel = WIN32OLE.new(‘Excel.Application’)
response = excel.InputBox(prompt, title)
excel.Quit
excel = nil
return response
end

response = get_input(‘My Prompt’, ‘My Title’)

Hope that helps.

David
http://rubyonwindows.blogspot.com

On 4/26/07, edcrosbys [email protected] wrote:

I’m new, please bear with me?

Welcome to the group.

I am trying to get a bit of data from the user. The only library I’m
using now is watir (since I’m interacting w/ web pages). I can use get
or STDIN.read to grab the input, but I would like to do something like a
typical windows pop-up dialog box. Is there anything out there? If you
point me in the general direction I might be able to find it. I started
checking out the OLE stuff in hopes of finding it, but came back empty
handed.

This one is a bit of an unusual suggestion, but considering your web
app background I thought I could throw it out there:

You could use Camping - a tiny web app framework to get user input,
and then invoke your scripts (or whatever else you are using the
user input for).

Everyone - thank you very much for pointing me in the right directions!

I guess my ASSUMPTION that ole would give me a string type dialog box
was VERY wrong!

Thanks for the Excel OLE hack! After spending under 5 min at each of the
GUI places, I THINK FXRuby will be the easiest. Although, Major props
for the Excel hack, I am going to play with it just to see what kind of
resources it takes (and if I can get decent response times). But that’s
just b/c I’m curious.

Thank you VERY Much!!!

Richard C. wrote:

This one is a bit of an unusual suggestion, but considering your web
app background I thought I could throw it out there:

You could use Camping - a tiny web app framework to get user input,
and then invoke your scripts (or whatever else you are using the
user input for).

Richard-

Unfortunately I can only claim a unix scripting background. Watir is
what originally drew me into Ruby (although I am using at work now for
other things!). I’m scripting some repetative, boring, mundane web
applications I use regularly. I am trying to make the scripts a bit more
robust by allowing the user to input the fields that change regularly.
I’ll check camping out though… I can think of uses for it too… Wow,
ruby is trying to take my life away, huh?!? =)

On Apr 26, 5:20 am, edcrosbys [email protected] wrote:

Thank you!


Posted viahttp://www.ruby-forum.com/.

You may want to take a look at Ruby Web Dialogs
http://www.erikveen.dds.nl/rubywebdialogs/index.html

Luis

This forum is not affiliated to the Ruby language, Ruby on Rails framework, nor any Ruby applications discussed here.

| Privacy Policy | Terms of Service | Remote Ruby Jobs