Dirhtml Help - Scripts (Variables)

The following variables can be used in /START, /END, /BETWEEN_FILES_AND_FOLDERS, /BEFORE_ANCHORS, /FILE_TABLE_START, /FILE_TABLE_END, /FOLDER_TABLE_START, /FOLDER_TABLE_END, /ANCHOR_TABLE_START, /ANCHOR_TABLE_END, /PRE_FNAME_FILE and /BEFORE_SUMMARY:

VariableDescription, Use
%%DIR Inserts the fully qualified path (for example: C:\Windows\System)
Note: Works in /PRE_HREF_FILE and /POST_HREF_FILE, and as part of a root folder word
%%FOLDER    Inserts the folder (for example: Desktop)
Note: Works as part of a root folder word
%%ROOT_FOLDER%    Inserts a relative reference to the root build folder (e.g. "../../../../../")
Note: Works in /HEAD sections
For example: <link rel="stylesheet" type="text/css" href="%%ROOT_FOLDER%mystyle.css">
%%RELATIVE_PATH    Inserts the path relative to the root folder (for example: /Desktop/Folder)
%%DATE Inserts the date and time
%%DATE_NO_TIME%   Inserts the date (a trailing % is required)
%%DAY% Inserts the current day
%%MONTH% Inserts the current month
%%MONTH_NUM% Inserts the current month as a number
%%YEAR% Inserts the current year
%%TIME% Inserts the current time
%%DATE_MODIFIED% Inserts the date modified string, adjusted for the date format selected on the Miscellaneous page
%%F Inserts the filename, with character codes translated
(Note: only works in /FILE_HREF_APPEND, /PRE_HREF_FILE, /POST_HREF_FILE and /FILE_MATCHES sections)
%%FNAME% Inserts the filename, untranslated.
This is primarily intended to be used with a /FILE_HREF_APPEND, for example: title="%%FNAME%" (which shows a popup link reference in browsers).
(Note: only works in /FILE_HREF_APPEND, /PRE_HREF_FILE and /POST_HREF_FILE sections)
%%F_PATH Inserts the filename, including the relative path
(Note: only works in /FILE_HREF_APPEND, /PRE_HREF_FILE, /POST_HREF_FILE and /FILE_MATCHES sections)
%%FILE...% Inserts the contents of a text file.  The filename must be followed by %.
Example:  %%FILEsome_file.txt% inserts the contents of the file named some_file.txt.
Note: Absent a path, dirhtml will look for the file in the folder being searched first, then in the same folder as dirhtml.exe.
%%FILE...% can also be used in /ANCHOR and /ANCHOR_BEFORE sections.
~~FILE...~ The same as %%FILE variables, except internal variables are supported
An example script using ~~FILE (which inserts the contents of "some_file.txt" for "some_file.*" links:
/POST_HREF_FILE
<span style="color: black; background-color: blue">~~FILE%%RELATIVE_PATH%%NO_EXT_FNAME%.txt~</span>

~~FILE...~ variables are supported in these script sections: /PRE_HREF_FILE, /POST_HREF_FILE, /PRE_FNAME_FILE, /POST_FNAME_FILE
~~FILE...~ variables support these variables:  %%RELATIVE_PATH, %%NO_EXT_FNAME%, %%FNAME, %%FOLDER
%%F_PATH_2SLASH% Inserts the filename, including the relative path, using two forward slashes as folder qualifiers
Note: Works in /PRE_HREF_FILE and /POST_HREF_FILE
%%NO_EXT_FNAME% Inserts the filename with with no extension
This makes it possible to have screenshots point to video or other files with filenames that are identical except the extension.
(Note: only works in /FILE_HREF_APPEND, /PRE_HREF_FILE and /POST_HREF_FILE sections)
%%2SLASHDIR% Inserts the fully qualified path (for example: C:\Windows\System\), with two slashes appended
Note: Works in /PRE_HREF_FILE and /POST_HREF_FILE
%%2FSLASHDIR% Inserts the fully qualified path using two forward slashes (for example: C://Windows//System//), with two forward slashes appended
Note: Works in /PRE_HREF_FILE and /POST_HREF_FILE
%%SUMMARY    Inserts the summary statistics, which can use the /SUMMARY_STYLE script section
%%INCLUDES    Inserts the filenames include string
%%SKIPPED    Inserts the filenames exclude string
%%SPEC Inserts the file specification string
%%VERSION    Inserts the version of dirhtml that created the file
%%FOLDERS_INCLUDE%    Inserts the folders include string
%%COLUMNS% Inserts the number of columns in the current table.  For the file table, columns is automatically adjusted for extra included columns (e.g. size, date, time).
%%COLUMNS% can also be reduced by a specific number by using the form %%COLUMNS-##%", where ## number of columns to be subtracted from the total.  This makes it possible to use script code like the following:
/FILE_TABLE_START
<tr><td colspan="%%COLUMNS-1%" style="text-align: center">All td's except one</td><td>The rightmost td</td></tr>
%%RANDOM_COLOR% Inserts a random html color in the form #000000
Note: Colors are randomized on per script line basis, so if a script line has the variable twice, both colors will be the same
%%TOTAL_FILES%Inserts the total number of file links
%%TOTAL_FOLDERS%Inserts the total number of folder links
%%TOTAL_FILE_SIZE%Inserts the size of all linked files
%%ANCHOR_TOTAL_SIZE%Inserts the size of all linked files in the subfolder (only valid in /ANCHOR sections)
%%ANCHOR_TOTAL_FILES%  Inserts the number of linked files in the subfolder (only valid in /ANCHOR sections)
%%FILE_SIZES%  Inserts the file sizes string

%%FILE, %%DIR, %%FOLDER, %%ROOT_FOLDER% and %%VERSION can also be used in /HEAD.