1

I have a bunch of VBScripts and I wanted to have a GUI so that I don't have to double click the actual .vbs. Is there a way or other programming languages that can launch VBS and have GUI?

  • Just edit and post your vbscripts that you want to interface it with HTA and the members here will assiste you to build your own HTA. – Hackoo Apr 05 '15 at 22:40

2 Answers2

1

The first choice for a VBScript GUI is a HTA. All languages that can create a window/dialog and call external programs can run something like

P:\athto\corwscript.exe P:\ath\to\script.vbs pa ra me ters

So stick to HTA or pick the language you are most familiar with.

Ekkehard.Horner
  • 38,498
  • 2
  • 45
  • 96
1

This is a console menu. Right click and choose Open in Command Prompt. Only options 3 and 5 do anything. This is from Filter's menu code at https://skydrive.live.com/redir?resid=E2F0CE17A268A4FA!121

Set Arg = WScript.Arguments
set WshShell = createObject("Wscript.Shell")
Set Inp = WScript.Stdin
Set Outp = Wscript.Stdout


Showmenu

Sub ShowHelpMenu
    outp.writeline " -----------------------------------------------------------------------------"
    outp.writeblanklines(1) 
    outp.writeline " Menu"
    outp.writeline " ----"
    outp.writeblanklines(1) 
    outp.writeline "  1 Help              2 HTML Help          3 Version           4 History"
    outp.writeblanklines(1) 
    outp.writeline "  5 Exit"
    outp.writeblanklines(1) 
    outp.write "Filter>"
End Sub

'=============================================
Sub ShowMenu
    Do
        ShowHelpMenu
        Answ=Inp.readline
        If Answ = "1" Then
            ShowGeneralHelp "TEXT"
        Elseif Answ = "2" Then
            ShowGeneralHelp "HTML"
        Elseif Answ = "3" Then
            Version
        Elseif Answ = "4" Then
            History
        Elseif Answ = "5" Then
            Exit Do
        End If
    Loop
End Sub

'=============================================
Sub History
    On Error Resume Next
    WshShell.Run """" & FilterPath & "FilterHistory.txt""" , 1, False
    err.clear
End Sub

'=============================================
Sub Version
    outp.writeblanklines(1) 
    outp.writeline " Version"
    outp.writeline " -------"
    outp.writeblanklines(1) 
    outp.writeline "   Filter Ver 0.6  -  2015  (Public Domain)"
    outp.writeblanklines(1)
    outp.writeline "   by David Candy"
    outp.writeblanklines(1)
End Sub

HTA or web pages give VBSript graphical ui. The main difference is HTA avoid security prompts. Although if you load a local web page, so do web pages. You program an HTA as if it's a web page.

Here's an HTA in HTML/VBScript, It uses a object that is a text database object.

<html>
<head>
<style>
BODY        {font-size :100%;font-family: Arial, Helvetica, sans-serif;color: black;
        background:URL(images/watermark.gif);background-color: white;
        margin-top:0; margin-left:0pt; margin-right:0pt ; text-align:Justify}
P       {margin-left:40pt;margin-right:10pt}
TABLE       {font-size: 90%; text-align:left; margin-left:40pt;margin-right:10pt;background-color:lavender;width:90%}
THEAD       {color: white;font-weight:bold;background-color:darkblue; margin-left:40pt;margin-right:10pt}
TD      {Vertical-Align:Top;padding:3px}
</style>
</head>
<body>
<OBJECT CLASSID="clsid:333C7BC4-460F-11D0-BC04-0080C7055A83"
    ID=dsoMacro5 WIDTH=0 HEIGHT=0>
    <PARAM NAME="DataURL" VALUE="music.txt">
    <PARAM NAME="UseHeader" Value="True">
    <PARAM NAME="FieldDelim" VALUE="&#09;">
    <PARAM NAME="Sort"  Value="Title">
</OBJECT>
<h3>My Music Database</h3>
<h4>Select a button to filter list</h4>
<p>To search for a word in the Title field use <i>* word *</i>. To search for the first word in a field use <i>Word *</i> or the last word use <i>* word</i>. To search for a string within a word or word use <i>*partialword*</i>. Searches are case sensitive.</i></p>
<p><INPUT Name=tb1 TYPE=Text Value=""> <INPUT ID=cmdNavFirst TYPE=BUTTON VALUE="     Search     " onclick="dsoMacro5.object.filter='Title=' + tb1.value;dsoMacro5.reset()"></p>
<p><INPUT ID=cmdNavFirst TYPE=BUTTON VALUE="   Sort Book   " onclick="dsoMacro5.object.sort='Book';dsoMacro5.reset()"></p>
<hr class="body">
<TABLE ID=tblMacro2 DATASRC=#dsoMacro5 OnRowEnter=Alert(tblMacro2.row)>
<THEAD>
<TR>
<TD WIDTH="20%"><b>Number</b></TD>
<TD WIDTH="60%"><b>Title</b></TD>
<TD WIDTH="20%"><b>Book</b></TD>
</TR>
</THEAD>
<TBODY>
<TR>
<TD WIDTH="20%"><SPAN DATAFLD=Number></SPAN></TD>
<TD WIDTH="60%"><SPAN DATAFLD=Title></SPAN></TD>
<TD WIDTH="20%"><SPAN DATAFLD=Book></SPAN></TD>
</TR>
</TBODY>
</TABLE>
</body>
</html>

For this to work you need a database file called music.txt. Note that is TABS between fields.

Number  Title   Book
1   One A song
2   Two A another song
3   Three   A yet another song
4   Four    Yes it's a song
Serenity
  • 174
  • 3