use o navegador como GUI em Ruby
Em vbscript, é comum usar o navegador (IE) como uma GUI. Veja o exemplo abaixo, ele pede um nome e o retorna ao script. Em Ruby você tem algumas GUIs como Tcl e Shoes, mas eu me pergunto como fazer isso no navegador. Qual é a solução Ruby mais simples para fazer isso? Portanto, não exta gems ou pacotes, nenhum servidor que já esteja em execução .. Se for necessária uma gem, de preferência uma que funcione no Windows sem problemas.
Aqui a amostra vbscript
Set web = CreateObject("InternetExplorer.Application")
If web Is Nothing Then
msgbox("Error while loading Internet Explorer")
Wscript.Quit
Else
with web
.Width = 300
.Height = 175
.Offline = True
.AddressBar = False
.MenuBar = False
.StatusBar = False
.Silent = True
.ToolBar = False
.Navigate "about:blank"
.Visible = True
end with
End If
'Wait for the browser to navigate to nowhere
Do While web.Busy
Wscript.Sleep 100
Loop
'Wait for a good reference to the browser document
Set doc = Nothing
Do Until Not doc Is Nothing
Wscript.Sleep 100
Set doc = web.Document
Loop
'Write the HTML form
doc.Write "Give me a name<br><form><input type=text name=name ><input type=button name=submit id=submit value='OK' onclick='javascript:submit.value=""Done""'></form>"
Set oDoc = web.Document
Do Until oDoc.Forms(0).elements("submit").Value <> "OK"
Wscript.Sleep 100
If web Is Nothing or Err.Number <> 0 Then
msgbox "Window closed"
Wscript.Quit
End If
Loop
name = oDoc.Forms(0).elements("name").value
oDoc.close
set oDoc = nothing
web.quit
set web = nothing
Wscript.echo "Hello " & name