[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Getting user input on windows...

edcrosbys

4/26/2007 10:21:00 AM

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!

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

7 Answers

Phillip Gawlowski

4/26/2007 12:52:00 PM

0

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. ;)

--
Phillip "CynicalRyan" Gawlowski
http://cynicalryan....
http://clothred.rub...

Rule of Open-Source Programming #48:

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

Lyle Johnson

4/26/2007 1:25:00 PM

0

On 4/26/07, Phillip Gawlowski <cmdjackryan@googlemail.com> 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.f...).

David Mullet

4/26/2007 1:45:00 PM

0

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.bl...

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

edcrosbys

4/26/2007 2:19:00 PM

0

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!!!

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

Richard Conroy

4/26/2007 2:36:00 PM

0

On 4/26/07, edcrosbys <edcrosbys@gmail.com> 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).

edcrosbys

4/26/2007 3:07:00 PM

0

Richard Conroy 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?!? =)

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

lrlebron@gmail.com

4/26/2007 3:36:00 PM

0

On Apr 26, 5:20 am, edcrosbys <edcros...@gmail.com> 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!
>
> --
> Posted viahttp://www.ruby-....

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

Luis