Get
this plugin and
these scripts. Put foo_lua.dll into your components directory, the other two DLLs go into your foobar2000 directory. You can put the scripts anywhere you like.
When the plugin is installed, run "Components/Scripting/Run lua script...". Select dbstats.lua and hit "Run". When prompted for an LHTML file, choose Example_1.lhtml from the scripts archive. Finally choose an output file. You can edit dbstats-prefs.lua to prevent the script from asking you for the names of these files, when you want to automate the process.
Disclaimer: I have stopped development of this plugin, and I currently don't have plans to pick it up again. The plugin uses Lua 5.0 and toLua++ 1.0 (both slightly modified). Source code can be picked up from
here, a few meager hints for compiling are in this
readme.
If you want to learn more about Lua, visit the
official Lua homepage. Recommended reading, if you want to learn about programming in Lua:
Lua 5.0 Reference Manual,
Programming in Lua (online version of the book by Roberto Ierusalimschy).