Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Getting user input on windows...

41 views
Skip to first unread message

edcrosbys

unread,
Apr 26, 2007, 6:20:50 AM4/26/07
to
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-forum.com/.

Phillip Gawlowski

unread,
Apr 26, 2007, 8:52:10 AM4/26/07
to
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.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.

Lyle Johnson

unread,
Apr 26, 2007, 9:24:51 AM4/26/07
to
On 4/26/07, Phillip Gawlowski <cmdja...@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.fxruby.org/).

David Mullet

unread,
Apr 26, 2007, 9:44:44 AM4/26/07
to

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

Eric Crosby

unread,
Apr 26, 2007, 10:19:17 AM4/26/07
to
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 Conroy

unread,
Apr 26, 2007, 10:35:35 AM4/26/07
to
On 4/26/07, edcrosbys <edcr...@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).

Eric Crosby

unread,
Apr 26, 2007, 11:06:38 AM4/26/07
to
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?!? =)

lrle...@gmail.com

unread,
Apr 26, 2007, 11:35:45 AM4/26/07
to

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

Luis

0 new messages