six demon bag

Wind, fire, all that kind of thing!

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]