ScanDir (0.1 beta1):
by Vendicator

The purpose of this module is to make some config scenarios more dynamic.
So far it's been tested as a popup based theme switcher and fontselecting
could be made to work with textedit, but probably you can come up with even
more uses than I can...

Config:

ScanDirs name1 name2
	Specify the names of the scandirconfigs you want to use
	will look for name1Path, name1Files, name1OutputFile, name1OutputFormat etc..

[NAME]Path:
	Directory which to scan

[NAME]Files (nothing tested):
	[dirs] - lists only directories
	[files] - opposite to dirs
	[fonts] - lists only fonts
	[archive] - only with attribute archive set
	[hidden] - only with attribute hidden set
	[normal] - only with attribute normal set
	[system] - only with attribute system set
	[all] - same as *.*
	dos commands like *.*, *.exe etc.

[NAME]OutputFile:
	Path and filename of where to output the data.

[NAME]OutputFormat:
	[filename] - name of hit
	[path] - full path to dir with hit
	[filenr] - sequentially increasing nr for each hit, not tested
	[fontname] - name in a .ttf file, doesn't seem to work with all fonts
	[modified] - date of modification, not tested
	[created] - date of creation, not tested
	[accessed] - date of last access, not tested
	[extension] - extension of file, not tested
	[size] - file size, in bytes, not tested
	[attrib] - normal, hidden, system etc.

	Escape codes: \n, \t, \v, \", \', \\
	ex:	[\n] - makes a new line
		[\t] - horizontal tab
		[\v] - vertical tab
		[\"] - "
		[\'] - '
		[\\] - backslash \

Optional:

[NAME]FoundString
	Additional string to output in the file if something is found in dir

[NAME]NothingString
	Additional string to output in the file if dir was empty

[NAME]OutputPrefix, not tested
	Additional string to output first in file

[NAME]OutputSuffix, not tested
	Additional string to output last in file

[NAME]IncludeRootSelf:
	to include folder like "." & ".."

[NAME]DisableStartupScan
	Disables scan of this config folder at startup & recycle,
	requires manual scan through !scandir [NAME]

Example of themes switching:
	ScanDirs			Themes
	ThemesPath			$litestepdir$themes\
	ThemesFiles			*.*
	ThemesOutputFile	$litestepdir$personal\themeselect.rc
	ThemesOutputFormat	*Popup [filename] !scandirSetTheme [filename]

Example of font setting:
	ScanDirs			fonts
	fontsPath			$windir$fonts
	fontsfiles			*.ttf
	fontsoutputfile		$litestepdir$personal\fontselect.rc
	fontsoutputformat	*popup Setfont: [fontname] !BangToChangeFontTo [fontname]

!bangs:

!ScanDir [NAME]
	Scans the dir with that config name ([all], or no args for all dirs)
	ie. ScanDir Themes, [all], etc

!ScanDirSetTheme
	Tries to set the current theme in step.rc to the foldername given,
	looks for a step.rc in folder first,
	assumes themesdir is $litestepdir$themes when writing the step.rc (is this ever false?)


Todo:
  - Recursion for subdirs?
  - Use error code to disable output of non working fonts
  - special handling of first/last found entry
  - Name sorting, would need data buffering

Changelog:

- Fixed [Vendicator, 02-08-12]
  - Seemed stable enough to allow for a beta1 release, yay!
  - Fixed fontscanning.
  - Fixed stupid bug when no found/nothing strings were entered
  - Unknown commands are simply outputted to file, with warning to log about which they were...

- Added [Vendicator, 02-08-04]
  - Added [NAME]FoundString, [NAME]NothingString to output of file
  - Implemented escape code, must be in brackets []

- Fixed [Vendicator, 02-08-03]
  - Threaded ScanAllFolders, should address any startup delays...

- Fixed [Vendicator, 02-08-02]
  - Added handling when running !scandir without arguments
  - Added [NAME]DisableStartupScan so you don't need to trash your disk on each recycle

- Added [Vendicator, 02-07-28]
  - Added !ScanDirSetTheme to enable use of ScanDir as a themeswitcher

- Fixed [Vendicator/MickeM, 02-07-27]
  - Found stupid bug in font name reader that prevented some names to be read

- Added [Vendicator, 02-07-26]
  - Added fontname reader, from codeproject article by Philip Patrick,
    thanks to Message for finding my stupid misstakes.

- Added [Vendicator, 02-07-25]
  - Fixed the dir scanning thanks to MickeM
  - Implemented the rest of the modules functions, parsing, output etc.

- Added [Vendicator, 02-07-23]
  - First work, did multiple settings loader