2008 note: ok, this isn't .Net but I was getting rid of the VBClassic pages and this was too good to throw away. The MSScriptHost control/dll can still be called by C# and VB.Net via interop and what it offers is still a cool option. Cool because vbscript is still easier for most end users than learning a new custom script language as some people are pushing - ihmo. One day I'll port it to C#/VBN or you can do it and send it to me ;-) Recently we had to do maintenance on a hard-coded text file parser; You know the deal the source file changed format and now a few hundred lines of undocumented code had to to be checked and Mid$() statements had to be re-set. After about an hour we realized that this was but one of many parser applets in the company ... and eventually the same stupid tedium would have to be repeated again and again. That is the call for automation! Do it once and never have to do it again. But how to really get that done, after all beyond the Mid$s, most parsers have a lot of hard-code for data conversions and analysis. At first it seemed that making a helper might have to be forgotten ... but then we remembered the MS ScriptControl. Wait, if you're saying "Yuk, another ocx that requires a host form ... making VB look like Delphi with all of it's form-hosted non-visual controls" think again! The script control does not require a host form, it can be called directly and very easily so it is perfect for use from classes or even your own ActiveX dlls! This SmithVoice demo shows just how simple it is. Run the project and choose a sample script ... the routine is displayed (and is editable at run time) in the text box. Press the "Do It" button and ... it does it. 
The samples are a simple date formatter and a CDO-based emailer (change the address to your own or I'll know every time you run a test <g>). These sample are self contained, but scripting is just as easy with passed in dynamic argument values!
Click here to get! (just 3k!) Hope it helps! Robert Smith
Kirkland, WA For an in-depth demonstration of scripting with dynamic arguments, see the new SmithVoice.com FlatFile Dumper page. added to smithvoice october 2000 |