12

I am looking for a library to create reasonably usable 2D GUIs using standard control types (drop lists, text boxes, buttons, etc. housed in a window or dialog box) in the VBScript programming environment, on the desktop, using the Windows Scripting Host (WScript.exe).

I already looked at HTA documents, but the UI is extremely antiquated, clunky, and slow, because it's hosted in an instance of IE; it's also limited in functionality by the web platform, or more specifically, by IE's poor implementation of the web platform.

To give an idea of the type of thing I'd like to use, the .NET System.Windows.Forms namespace is a proper superset of the kinds of things I need, and I don't need anything like animations, 3D, etc. that would be available in a more advanced framework like WPF.

So, if we are to scale our desktop UI sophistication expectations back to about the year 2003 or so, is there a COM library that can be instantiated to design custom Windows UIs in VBScript / Windows Scripting Host? I already know that the native Win32 API is not available, so CreateWindowEx and family from user32.dll can't be directly called. That is why I am looking for a piece of software.

  • Are you limited to using VBScript? PowerShell (available for XP+) supports the creation of GUIs with .NET. – ComFreek Aug 17 '14 at 11:29
3

You can build an GUI in VBScript with WindowSystemObject
(I am its developer).

For example:

Set wso = WScript.CreateObject("Scripting.WindowSystemObject")

wso.EnableVisualStyles = true

Set form = wso.CreateForm(0,0,0,0)
form.ClientWidth = 150
form.ClientHeight = 120
form.CenterControl()

Set input1 = form.CreateEdit(10,10,100,25)

Set input2 = form.CreateEdit(10,30,100,25)

Set input3 = form.CreateEdit(10,50,100,25)

Set button = form.CreateButton(10,70,75,25,"Close")

button.OnClick = GetRef("ButtonClick")

Sub ButtonClick(this)
        form.messageBox(input1.text & input2.text & input3.text)
End Sub

form.Show()

wso.Run()
  • Excellent piece of software! Thank you!! – allquixotic Nov 19 '15 at 17:10
3

If you are completely tied to using VBScript, you could develop a HTML Application (or HTA). It's just HTML driven by VBScript instead of JavaScript.

This was actually already discussed in a Stack Overflow question, and there's even a Wizard for it(as mentioned in the SO post)!

Edit: Didn't see your note about using HTA before. If you prefer to not HTA, I believe GTK supports the use of VBScript via the GTK-Server. Its a bit of a mess (at first glance, it seems to be use through STDIN to GTK), but you can do UI's with it.

If all else fails, there's always an option of rewriting this in Visual Basic, and just using that...

0

I create a HTA VBS front end that employee a config file and source HTA file.

I've tested this with IE11 and Firefox on windows 8.1, windows server 2012 and windows 10 and VMWare. This is open source file written by me.

  • Do you have any URL examples, documents or discussions on this topic? – DankyNanky Jan 22 '18 at 10:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.