Forum: Ruby simple way to duplicate vba's InputBox, Msgbox?

Announcement (2017-05-07): www.ruby-forum.com is now read-only since I unfortunately do not have the time to support and maintain the forum any more. Please see rubyonrails.org/community and ruby-lang.org/en/community for other Rails- und Ruby-related community platforms.
674c6cb863d477a52725825f95c6352b?d=identicon&s=25 Phil (Guest)
on 2008-11-18 21:20
(Received via mailing list)
I've always used VBScript to write the simple scripts I
occasionally need. But now that I've learned a tiny bit of
ruby, I don't want to use vbscript anymore!

Unfortunately for me, ruby has nothing like InputBox() and Msgbox().
While I'm comfortable with the command prompt and often prefer
it, sometimes its just more convenient to run scripts directly
from windows.

As I'll probably never need any more "GUI capabilities" than
 those two statements provide, it seems like fxruby, ruby tk,
 etc. is overkill for my simple needs.

I did run across "Ruby & Excel: The InputBox Hack" but of
course it's slow and at least for me, the prompt is not
"active" (you have to Alt-tab to get to it)

Any comments or suggestions would be appreciated.
87349a7a95b3f2e83c20194ef122885c?d=identicon&s=25 Einar Magnús Boson (Guest)
on 2008-11-18 21:49
(Received via mailing list)
www.shoooes.net
You can get a simple window with inputbox like this:


Shoes.app :width => 220, :height => 100 do

   para "Type some text:"

  edit_line(:width => 200).change { |el|
    alert el.text
  }

end




On 18.11.2008, at 20:16 , Phil wrote:

> those two statements provide, it seems like fxruby, ruby tk,
> etc. is overkill for my simple needs.
>
> I did run across "Ruby & Excel: The InputBox Hack" but of
> course it's slow and at least for me, the prompt is not
> "active" (you have to Alt-tab to get to it)
>
> Any comments or suggestions would be appreciated.
>
>
>

einarmagnus
134ea397777886d6f0aa992672a50eaa?d=identicon&s=25 Mark Thomas (Guest)
on 2008-11-18 21:50
(Received via mailing list)
On Nov 18, 3:14 pm, "Phil" <philliprichardsNOTT...@hotmail.com> wrote:
> I've always used VBScript to write the simple scripts I
> occasionally need. But now that I've learned a tiny bit of
> ruby, I don't want to use vbscript anymore!
>
> Unfortunately for me, ruby has nothing like InputBox() and Msgbox().

Shoes (http://shoooes.net/) is a simple GUI toolkit and probably what
you're looking for. Sample:

if confirm("Do Something?")
  do_it
else
  do_something_else
end

-- Mark.
Bfa670ef2303deb7dec5a8027367b30b?d=identicon&s=25 David Mullet (mully)
on 2008-11-19 03:30
Phil wrote:

>
> Unfortunately for me, ruby has nothing like InputBox() and Msgbox().
>

You can display a MessageBox by via the Win32API:

http://rubyonwindows.blogspot.com/2007/06/displayi...

The result is very similar to VB's MsgBox function.

David

http://rubyonwindows.blogspot.com
674c6cb863d477a52725825f95c6352b?d=identicon&s=25 Phil (Guest)
on 2008-11-19 07:20
(Received via mailing list)
I now have a simple message_box "function"

Shoes looks very interesting, and so easy...
(at least to get a few trivial scripts working)

And i look forward to checking out zerenity and rdialog.

-- thanks to all!
This topic is locked and can not be replied to.