Building a GUI for a JScript App? RRS feed

  • Question

  • Basically I want to try exactly what the subject suggests - create  a standard         graphical user     interface with buttons, editboxes, context menu's, etc. for my JScript app.

    Currently, my understanding is that there are two ways of doing this:

    1. Create an ActiveX Control in your compiler that you then declare & create an instance of in your JScript. Presumably you'd compile a DLL?
    2. Use JScript .NET and create a Windows Form (somehow).
    Does anyone know if there are any other options? Options 1 & 2 are fine, I just want to be thorough.

    Wednesday, December 3, 2008 5:34 PM

All replies


    Use a HTA instead then you can build your UI using HTML and IEs DHTML but without the security limitation that a web page would have.



    Thursday, December 4, 2008 9:51 AM
  • You may want to try the Windows Script/Scripting Host (WSH)

    <?xml version="1.0" encoding="ISO-8859-1"?>
    <job id="IncludeExample">
        <script language="VBScript">
            Function WSHInputBox(Message, Title, Value)
                ' Provides an InputBox function for JScript
                ' Can be called from JScript as:
                ' var result = WSHInputBox("Enter a name", "Input", test);
                WSHInputBox = InputBox(Message, Title, Value)
            End Function
        <script language="JScript">
            // This is the JScript script, which reads user input
            // and displays it in a dialog box. It uses the
            // VBScript function WSHInputBox to create the
            // dialog box. 
            var vbOKOnly = 0;                // Constants for Popup
            var vbInformation = 64;
            var title = "InputBox function for JScript";
            var prompt = "Enter a name:";
            // Create the WshShell object (needed for using Popup).
            var WshShell = WScript.CreateObject("WScript.Shell");
            // Open the input dialog box using a function in the .wsf file.
            var result = WSHInputBox(prompt, title, "New York");
            // Test whether the Cancel button was clicked.
            if (result != null)   
            {  // Cancel wasn't clicked, so get input.
                var intDoIt =  WshShell.Popup("You entered: " + result,
                                              vbOKOnly + vbInformation);
            { // Cancel button was clicked.
                var intDoIt =  WshShell.Popup("Sorry, no input",
                                              vbOKOnly + vbInformation);
            //*** End

    save it in a .wsf file and run in the terminal with cscript/wscript

    Saturday, October 24, 2020 11:57 PM