six demon bag

Wind, fire, all that kind of thing!

2011-03-13

A Logger Class for VBScript

I got tired of having to re-implement logging routines for my VBScripts on a regular basis, so I wrote a logger class that serves as an abstraction layer for logging to interactive console/desktop, files or eventlog. Now I just instantiate a new logger, define the logging facilities (default is console/desktop for interactive, eventlog for non-interactive execution), and can log away with the same set of methods, regardless of log target. See API documentation for details.

See more ...

Posted 22:10 [permalink]

2011-02-16

Function for Reading INI Files

I wanted to be able to use INI files as configuration files for my VBScripts, so I wrote ParseIni() to parse the contents of an INI file into a dictionary of dictionaries. Comments are allowed and must begin with a semicolon. As of yet, any semicolon is treated as the beginning of a comment, so neither section titles nor key/value pairs can contain semicolons. I'll probably add a more sophisticated comment handling at some point, but right now this works well enough for me.

As usual the function can be used by either copy/pasting the code or by importing the file.

Posted 20:43 [permalink]

2011-01-13

Function for Inspecting (not only) Dictionary-based Data Structures

Dictionary-based data structures are quite handy in various situations. However, when the structures grow, they tend to become messy pretty fast. To deal with this issue I wrote a function DumpData() to inspect a given variable and return a string representation of its data. It can be used either by copy/pasting the code or by importing the script.

DumpData() was inspired by Perl's Data::Dumper module, although my little function is far less sophisticated. Just in case you were wondering.

Posted 14:15 [permalink]

2011-01-02

A Wrapper Class for VBScript Arrays

Although VBScript does support arrays, their handling leaves a lot to be desired. To deal with the shortcomings of the built-in arrays (or rather, to avoid having to deal with them) I wrote CArray, a wrapper class that provides operations like inserting, appending and removing elements, getting slices (sub-arrays), sorting, etc.

See more ...

Posted 03:23 [permalink]