# Using HTML FORMS on a client machine only from Ruby

**URL:** https://rubytalk.org/t/using-html-forms-on-a-client-machine-only-from-ruby/28685
**Category:** ruby-talk
**Created:** [6 July 2006 14:53 UTC](https://rubytalk.org/t/using-html-forms-on-a-client-machine-only-from-ruby/28685 "2006-07-06T14:53:51Z")
**Posts on this page:** 3
**Page:** 1

<div class="post-metadata">

### Author: ![Mike\_Austin4](https://avatars.discourse-cdn.com/v4/letter/m/fbc32d/32.png) [@Mike\_Austin4](https://rubytalk.org/u/Mike_Austin4)
#### Post date: [6 July 2006 14:53 UTC](https://rubytalk.org/t/using-html-forms-on-a-client-machine-only-from-ruby/28685/1 "2006-07-06T14:53:51Z")

</div>

"noone" \<noone@nowhere.com\> wrote in message  
news:vMgqg.13064$Uc3.2125@tornado.texas.rr.com...

> First, I apologize about the email address - it's obviously bogus.
> 
> I use Ruby quite a bit with SketchUp to automate different tasks and  
> processes. I've been using Ruby for only a couple years now, and I am

self

> taught via the books on the market as well as from other prograamers

working

> with the SketchUp Ruby API.
> 
> The user interface available with SketchUp is sparse, at best. I would  
> love to be able to harness the power of a browser via HTML and FORMS (et

al)

> from Ruby within SketchUp.
> 
> Can someone point me to a resource to use for this? Whatever I come up  
> needs to be cross platform (Windows and Mac only).
> 
> Thank a lot.
> 
> Todd Burch  
> toddb at smustard period com.

Perhaps I can reword/simplify the question a little bit for a response.

First, some background on me:

programming with Ruby, javascript - been there, done that.  
writing CSS, HTML, etc., been there, done that.  
Windows programming - never done it  
C/C++/Java - I've read the books, done the examples, still a newbie, no  
confidence.  
Macs - don't know a thing about them.  
Server setup or programming - never done it  
CGI scripts - never written one

So, with the persepctive, here is what I want to do:

I want to be able to write a Ruby script that (possibly creates, but  
ultimately) displays (synchronously) an HTML page with FORM widgets in it.  
I want to fill in the form data manually, press SUBMIT, and have the form  
information passed back, or available to, my Ruby script. I want this  
script work on a Mac and PC with little or no platform dependant coding.

Is this an out of the ordinary objective? Am I too naive and this simple of  
a scenario was never considered? It's seems to me to be easier to converse  
with a web page 1/2 way around the planet than on my own PC with IE or  
Navigator.

Todd

---

<div class="post-metadata">

### Author: ![Kirk\_Haines](https://avatars.discourse-cdn.com/v4/letter/k/c6cbf5/32.png) [@Kirk\_Haines](https://rubytalk.org/u/Kirk_Haines)
#### Post date: [6 July 2006 15:26 UTC](https://rubytalk.org/t/using-html-forms-on-a-client-machine-only-from-ruby/28685/2 "2006-07-06T15:26:19Z")

</div>

> I want to be able to write a Ruby script that (possibly creates, but  
> ultimately) displays (synchronously) an HTML page with FORM widgets in it.  
> I want to fill in the form data manually, press SUBMIT, and have the form  
> information passed back, or available to, my Ruby script. I want this  
> script work on a Mac and PC with little or no platform dependant coding.
> 
> Is this an out of the ordinary objective? Am I too naive and this simple of  
> a scenario was never considered? It's seems to me to be easier to converse  
> with a web page 1/2 way around the planet than on my own PC with IE or  
> Navigator.

There's nothing esoteric about that. Use Webrick or Mongrel. Use CGI, with or without a templating library, or use one of the Ruby web devel frameworks (Camping, Wee, Nitro, Rails, IOWA). I sometimes package entire websites, with all the dynamic bits or applications, onto a CD or DVD or in an archive file that clients can just pop into their computers, run a startup script on, and then use.

Kirk Haines

---

<div class="post-metadata">

### Author: ![Michael\_W\_Ryder1](https://avatars.discourse-cdn.com/v4/letter/m/8e7dd6/32.png) [@Michael\_W\_Ryder1](https://rubytalk.org/u/Michael_W_Ryder1)
#### Post date: [8 July 2006 00:50 UTC](https://rubytalk.org/t/using-html-forms-on-a-client-machine-only-from-ruby/28685/3 "2006-07-08T00:50:14Z")

</div>

noone wrote:

> > It sounds like what you need is Ruby on Rails. See rubyonrails.org for  
> > more information
> 
> Michael, thanks for taking the time to respond. I'm not sure if Rails is  
> what I want. I'll go look though...
> 
> OK, I looked. I don't think Rails is what I am looking for: "Rails is a  
> full-stack framework for developing database-backed web applications.."  
> I'm not doing this, and I'm not writing a web application. I'm writing a  
> client application - a ruby script, that calls a browser (to handle the  
> widgets/interface stuff), allows the user to fill out FORM data, and after  
> SUBMIT is presses, the data gets passed back to the Ruby scripts that called  
> the browser. And, it needs to work on Windows and a MAC.
> 
> In a picture:
> 
> 1) Ruby script gets kicked off.  
> 2) Ruby script calls browser (IE, Nav, Opera, Firefox, whatever - I don't  
> care), passing the name of an .html file with embedded javascript and form  
> tags.  
> 3) User interfaces with page, and clicks SUBMIT  
> 4) Form data is then passed back to the Ruby script that called the browser.  
> 5) Ruby parses data, processes data, etc... maybe even repeats to #2 above
> 
> #4 seems to be the issue here. (well, MY issue!) Perhaps #4 should read:
> 
> 4) Form data is then "put somewhere" where the Ruby script can go get it.

I suggested Rails as it simplifies the programming for the browser interface. You could store the data entered in step 2 in MySQL when the user presses the submit button in step 3 for later processing in step 5. This can be done synchronously in the controller where it displays a page, gets data, processes the data and returns to step 3. In step 3 you could have a button on the page to end the session.

> **···**
>
> > I'm OK with synchronous processing here too. It actually makes my coding  
> > easier to be synchronous. I don't need the sophistication of an  
> > asynchronous interface.
> > 
> > That's it! That's all I want. (Picture Steve Martin, AKA Navin Johnson,  
> > from "The Jerk", in his bathrobe, holding his little umbrella...)
> > 
> > Todd.
