Adding a GUI to VBScript

VBScript has dialogs, only not many and no checkboxes, you would need a COM object to do so (and there are). I’m sure you know Messagebox and here an example of the less known Popup

Dim WshShell, BtnCode
Set WshShell = WScript.CreateObject("WScript.Shell")

BtnCode = WshShell.Popup("Do you feel alright?", 7, "Answer This Question:", 4 + 32)

Select Case BtnCode
   case 6      WScript.Echo "Glad to hear you feel alright."
   case 7      WScript.Echo "Hope you're feeling better soon."
   case -1     WScript.Echo "Is there anybody out there?"
End Select

However, the best way to have more dialogs in vbscript is using HTA.
Here an example

<HTML><HEAD>
   <HTA:APPLICATION
   ID = "oApp"
   APPLICATIONNAME = "Example"
   BORDER = "thick"
   CAPTION = "yes"
   ICON = "app.ico"
   SHOWINTASKBAR = "yes"
   SINGLEINSTANCE = "yes"
   SYSMENU = "yes"
   WINDOWSTATE = "normal"
   SCROLL = "yes"
   SCROLLFLAT = "yes"
   VERSION = "1.0"
   INNERBORDER = "yes"
   SELECTION = "no"
   MAXIMIZEBUTTON = "yes"
   MINIMIZEBUTTON = "yes"
   NAVIGABLE = "yes"
   CONTEXTMENU = "yes"
   BORDERSTYLE = "normal"
   >

   <SCRIPT language="vbscript">
   sub SimpleExeample()
     document.body.innerHTML = "<form name=myform><input type=checkbox name=chk1>Check me<br><br><button onclick='alert(myform.chk1.checked)'>Show if checked</button></form>"
   end sub
   </SCRIPT>

</HEAD>
<BODY onLoad="SimpleExeample()">
</BODY>
</HTML>

In one thing i agree with Cody, vbscript is nearly dead, if you start programming choose another language. Take a look at Ruby, the start is easy to learn an it is FUN.
Here an example of u ruby script using shoes as GUI

require 'green_shoes'
Shoes.app{
  button("Click me!"){alert("You clicked me.")}
}

EDIT: since my Ruby alternative rises some questions, here a more traditionel way closer to Vbscript uses of the same sample. The sample above is used more for a functional chained way of programming.

require 'green_shoes'
Shoes.app do
  button("Click me!") do
    alert("You clicked me.")
  end
end

Leave a Comment