Posted on 2011-05-07
Last Modified: 2012-06-27

I have a vbscript that I initiate with the following syntax:  "cscript  process.vbs  inputfile outputfile".  All input is static except for the input filename.  I need to pass this off to a receptionist that can run by clicking on  a desktop shortcut then browse to the input file so I really need some sort of GUI for this vbs.  Any suggestions?

Question by:jon1966
    LVL 17

    Assisted Solution

    by:Tony Massa
    LVL 11

    Assisted Solution

    by:Serge Fournier
    i programmed a web interface for vbscript

    by pushing html in an internet explorer interface, with a few subs for inputing data (or file names)
    i already did program a html listing (in a table) to list the files in the directory and click on a button to choose a specific file (chek the edit mbd section in the script, starting at line 476, i read all mdb file in the directory and offer a choice in an html table)

    if you are really interested, i can send you my latest version, as i cannot modify my article everytime i update this interface

    i only suggest this as i see you as a qualified expert, that mean you must know VBS good ;)
    LVL 11

    Expert Comment

    by:Serge Fournier
    tmassa99 solution look smaller hehe
    LVL 65

    Accepted Solution

    Hi, the file chooser given by tmassa99 will only work on Windows XP as far as I'm was the only OS to come with that control.

    The workaround is to use Microsoft Word to show the Open File Dialog.


    'cscript  process.vbs  inputfile outputfile
    strVBS = "C:\Temp\Scripts\Test1.vbs"
    strOutputFile = "C:\Temp\Scripts\Test1.txt"
    Const msoFileDialogOpen = 1
    Set objWord = CreateObject("Word.Application")
    Set objFSO = CreateObject("Scripting.FileSystemObject")
    Set objShell = CreateObject("WScript.Shell")
    objWord.FileDialog(msoFileDialogOpen).Title = "Select the files to be deleted"
    objWord.FileDialog(msoFileDialogOpen).AllowMultiSelect = False
    If objWord.FileDialog(msoFileDialogOpen).Show = -1 Then
        objWord.WindowState = 2
        strCommand = ""
        For Each objFile in objWord.FileDialog(msoFileDialogOpen).SelectedItems
            strCommand = "cscript " & objFSO.GetFile(strVBS).ShortPath & " " & objFSO.GetFile(objFile).ShortPath & " """ & strOutputFile & """"
        If strCommand <> "" Then
    		'MsgBox strCommand
    		objShell.Run strCommand, 1, False
    	End If
    End If

    Open in new window

    LVL 3

    Author Closing Comment

    Great Job Thank you!

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    Training Course: Java/J2EE and SOA

    This course will cover both core and advanced Java concepts like Database connectivity, Threads, Exception Handling, Collections, JSP, Servlets, XMLHandling, and more. You'll also learn various Java frameworks like Hibernate and Spring.

    Welcome to part one of a multi-part tutorial series, VBScript for Windows System Administrators.  The goal of this series is to teach non-programmers how to write useful VBS code to automate their environment, and perform tasks faster, and in a more…
    Deploying a Microsoft Access application in a Citrix environment is not difficult but takes a few steps. However, Citrix system people are often of little help, as they typically know next to nothing about Access. The script provided here will take …
    It is a freely distributed piece of software for such tasks as photo retouching, image composition and image authoring. It works on many operating systems, in many languages.
    Polish reports in Access so they look terrific. Take yourself to another level. Equations, Back Color, Alternate Back Color. Write easy VBA Code. Tighten space to use less pages. Launch report from a menu, considering criteria only when it is filled…

    759 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    11 Experts available now in Live!

    Get 1:1 Help Now