GUI for VBSCRIPT

Hi,

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?

J
LVL 3
jon1966Asked:
Who is Participating?
 
RobSampsonCommented:
Hi, the file chooser given by tmassa99 will only work on Windows XP as far as I'm aware....it was the only OS to come with that control.

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

Regards,

Rob.
'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.ChangeFileOpenDirectory("C:\Temp")

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 & """"
    Next
    If strCommand <> "" Then
		'MsgBox strCommand
		objShell.Run strCommand, 1, False
	End If
End If

objWord.Quit

Open in new window

0
 
Serge FournierAnalyst ProgrammerCommented:
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)

http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/A_1053-web-interface-for-wsh-vbs-vbscript.html

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 ;)
0
 
Serge FournierAnalyst ProgrammerCommented:
tmassa99 solution look smaller hehe
0
 
jon1966Author Commented:
Great Job Thank you!
0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.