I bought a book - it was a revelation - so simple !!
It was called
Windows Script Host Programmer's Reference
- brilliantly
written - great but simple easy to understand examples.
You can find out about it on www.wrox.com
There is a download of examples available - follow the links and do the download. Maybe this link will get you directly to the page
When you get it and "Install it", you will see a file called
SETUP.VBS
It may be that your Antivirus checker will warn you when you double click on it that it may be malicious (Norton AntiVirus warns me) - believe me, it is safe - just tell the anti virus to do it this once - I did.
|
I just thought that I would tell you of an approach that I am using to achieve just that very successfully.
I have written a very very simple .VBS file that uses an HTML page to format the input screen. The input (once the script is launched) is completely keyboard oriented - navigation is by the Tab and enter keys.
Not found any data entry specialist that can "out-type" it !! The .VBS script writes an XML file.
Once input is complete, a Web Page is used to upload the file and some general purpose input fields (Record Counts, Hash Totals and a few other bits and bobs) The Web Page provokes dBase to read the uploaded XML file and update a dBase table and do some other processing, reply with an Acknowledgement Web Page and send an EMail to confirm the transactions. |
N O T E - If you are distributing the package for use, you do not need the whole of the Wrox download
for the script shown below to work!!
I use a product called "Inno SetUp" to distribute this package and include a very much stripped down
version of the stuff from Wrox.
The VBS script is shown below - it is called "CREATEML.VBS"
'' ArrayToFile.js
'' Writes the contents of an array to the specified text file
'' ----------------------------------------------------------------
'' FileProperties.vbs
'' Provides all the information available on a given file
'' -----------------------------------------------------------
Const ReadOnly = 1
Const Hidden = 2
Const System = 4
Const Archive = 32
'' Get the name of the file to query
Dim fileName, firstLine, lastItem
If WScript.Arguments.Count = 0 Then
fileName = InputBox("Enter the FULLY-QUALIFIED name of the ~~
~~this is a line broken only for clarity of documentation~~
file to store the list in:", "File Name", "C:\maillist.xml")
Else
fileName = WScript.Arguments.Item(0)
End If
If fileName = "" Then
WScript.Quit
End If
Set fso = CreateObject("Scripting.FileSystemObject")
Set a = fso.CreateTextFile(fileName, True)
firstLine = "<maillist type=" & Chr(34) & "root" & Chr(34) & ">"
a.WriteLine firstLine
Dim dlg
Set dlg = CreateObject("WshKit.DialogBox")
moreToDo = "yes"
lastItem = "Nothing Yet"
Do while (moreToDo = "yes")
If dlg.Create("path://maillist.htm") = True Then
dlg.SetItemText "last_item", lastItem
dlg.Move 0, 0, 700, 500
Set g_htmldoc = dlg.Document
g_htmldoc.All.recip_name.focus()
If dlg.Show("center") = True Then
moreToDo = dlg.GetItemValue("more_entries")
recip_email = dlg.GetItemValue("recip_email")
recip_name = dlg.GetItemValue("recip_name")
salutation = dlg.GetItemValue("salutation")
unique_ref = dlg.GetItemValue("unique_ref")
valedict_n = dlg.GetItemValue("valedict_n")
string_1 = dlg.GetItemValue("string_1")
string_2 = dlg.GetItemValue("string_2")
string_3 = dlg.GetItemValue("string_3")
If recip_email = "" Then
MsgBox "No EMail address entered - nothing recorded",64,"MailList"
Else
writeLine = " <recipient_email value=" & Chr(34) & recip_email & Chr(34) & ">"
a.WriteLine writeLine
If recip_email <> "" Then
writeLine = " <recipient_name value=" & Chr(34) & recip_name & Chr(34) & "/>"
a.WriteLine writeLine
End If
If salutation <> "" Then
writeLine = " <salutation value=" & Chr(34) & salutation & Chr(34) & "/>"
a.WriteLine writeLine
End If
If unique_ref <> "" Then
writeLine = " <unique_ref value=" & Chr(34) & unique_ref & Chr(34) & "/>"
a.WriteLine writeLine
End If
If valedict_n <> "" Then
writeLine = " <valedict_n value=" & Chr(34) & valedict_n & Chr(34) & "/>"
a.WriteLine writeLine
End If
If string_1 <> "" Then
writeLine = " <string_1 value=" & Chr(34) & string_1 & Chr(34) & "/>"
a.WriteLine writeLine
End If
If string_2 <> "" Then
writeLine = " <string_2 value=" & Chr(34) & string_2 & Chr(34) & "/>"
a.WriteLine writeLine
End If
If string_3 <> "" Then
writeLine = " <string_3 value=" & Chr(34) & string_3 & Chr(34) & "/>"
a.WriteLine writeLine
End If
a.writeLine (" <date_time_added value=" & Chr(34) & now & Chr(34) & "/>")
a.WriteLine (" </recipient_email>")
lastItem = recip_email
End If
else
moreToDo = ""
MsgBox "You clicked Cancel, the data in the form has not been stored", 64, "MailList"
End If
Else
MsgBox "Template not found.", 64, "MailList"
End If
Loop
a.WriteLine ("</maillist>")
a.Close
The HTML script is shown below - it is called "MAILLIST.HTM"
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<script>
function startUp()
{
document.input_name.recip_name.focus();
}
</script>
<title>Collect Mail List Data</title>
</head>
<body onLoad="startUp()">
<form name="input_name">
<H1><CENTER><B>Store MAILING LIST locally</B></CENTER></H1>
<input type="text" tip="Recipients Name" id="recip_name" size="50"> Recipients Name
<BR>
<input type="text" tip="Recipients EMail" id="recip_email" size="50"> Recipients EMail
<HR>
<B>Optional information</B><BR>
<input type="text" name="salutation" size=50> ^^^SALUTATION^^^<BR>
<input type="text" name="unique_ref" size=50> ^^^UNIQUE_REF^^^<BR>
<input type="text" name="valedict_n" size=50> ^^^VALEDICTION^^^<BR>
<input type="text" name="string_1" size=50> ^^^STRING_1^^^<BR>
<input type="text" name="string_2" size=50> ^^^STRING_2^^^<BR>
<input type="text" name="string_3" size=50> ^^^STRING_3^^^<BR>
<HR>
More Entries ?
<input type="text" tip="More Entries" id="more_entries" value="yes" size="6">
</form>
<br>
Last Item Processed:- <span tip="Last Item processed" id="last_item">None</span>
</body>
</html>
Note once again Norton AntiVirus tells me that the script may be malicious - I know that it is not - I
wrote it !!
I tell it to authorise the script. That way it runs OK thereafter.
The page for uploading with the bits and bobs are fairly simple and straightforward - but if you need guidance, ask at the bottom of the page.
The processing on the server is outside of the scope of this note - but if you need guidance, ask at the bottom of the page.