(v7.70.0002, 19-oct-2008).
Code: Select all
v7.70.0002 - 2008-10-19 15:40
+++ Scripting got a powerful new function called Report(). Better
reporting has been on my list since years (i.e. long before
scripting) but I never got around doing it because I did not like
the idea of adding an extra GUI for it, resp. I did not like my
GUI ideas for it. Now, with scripting, the perfect GUI-free
environment for fully customizable one-click reports is here!
Name: Report
Action: Return a report of the current file list contents.
Syntax: report([template], [onlyselected=0], [header], [footer])
template: [optional]
Defines the layout of one line (file record); for each
reported file one line is created based on this template.
If missing or empty: Take the current list data as is.
onlyselected:
0: [default] report all current list items
1: report all currently selected list items
header: any string data to be put at the top of output
footer: any string data to be put at the bottom of output
return: the report
Omitting the Template
~~~~~~~~~~~~~~~~~~~~~
If you omit the template argument (or pass "") the report you get
is identical to the list you see: Same types and sequence of
columns, same file data in same format. The fields are separated
by TAB characters.
Using the Template
~~~~~~~~~~~~~~~~~~
If you use the template argument you are in full control and can
decide what is shown, where it is shown, and how it is shown.
The various file data are defined by fields, corresponding to the
columns the file list. A field consists of a field name and, in
some cases, an optional format definition, separated from the
field name by a single blank. The fields are enclosed in curly
brackets {}, and they are not case-sensitive (i.e. a=A).
Example for a template argument:
"No. {#}, {name}, {size kb} ({size b}), {modified yyyy-mm-dd}"
The following fields are currently supported (they obviously match
the file list's column headers):
- Browse Mode
{#}, {Name}, {Ext}, {Size}, {Type}, {Created}, {Modified},
{Accessed}, {Attr}, {Len}
- Find Mode
{#}, {Name}, {Ext}, {Size}, {Type}, {Created}, {Modified},
{Accessed}, {Attr}, {Len}, {Path}
- Drives Mode
{#}, {Name}, {Type}, {Total Size}, {Used Space}, {Free Space},
{Free %}, {Per Cluster}, {Vol Serial}, {File System}
Optional format definitions for {Size}:
{Size KBR} KB (rounded up)
{Size KB} KB
{Size B} Bytes (no suffix)
{Size BB} Bytes (with suffix)
{Size FLEXR} Flexible (rounded up)
{Size FLEX} Flexible
{Size RAW} Raw bytes (no thousand separators)
{Size MB} MB
{Size GB} GB
{Size} [no format: use current Size Column Format]
Optional format definitions for {Created}, {Modified}, {Accessed}:
{Created yyyy-mm-dd hh:nn:ss}
etc. ... the usual date format definitions...
{Created} [no format: use current Date Column Format]
Optional format definitions for {#}:
{# @@@@} fill with leading blanks
{# 000} fill with leading zeroes
Note that you cannot combine @ and 0 to have first leading
blanks and then leading zeroes.
Additional Special Fields
~~~~~~~~~~~~~~~~~~~~~~~~~
{Fullname}
- Field is set to the full path/name of the file.
- Obviously only for Browse and Find modes, not Drives.
{Dir dir_value|file_value|drive_value}
- Field is set to "dir_value" if item is a directory.
- Field is set to "file_value" if item is a file.
- Field is set to "drive_value" if item is a drive.
Note: "Dir" might be a confusing name for this field, but find a
better one... "file system object type"...?
{Zebra odd_value|even_value[|divisor=2]}
- Field is set to "odd_value" in all odd lines.
- Field is set to "even_value" in all even lines.
- The divisor defaults to 2 but you can set it to any larger
value so that e.g. the "even_value" (the value that divides by
the divisor without remainder) is set to every 5th line, the
"odd_value" to all other lines.
You can use this field to apply alternate formatting, e.g. to
achieve a zebra striping effect if you use HTML for your report,
or to group the output into blocks of a certain size. See
examples below.
Examples
~~~~~~~~
- ::text report();
Displays the current file list "as is" in a multiline textbox.
- ::text report("{modified yyyy-mm-dd hh:nn:ss}", 1);
Displays the modified date of all selected items in a multiline
textbox.
- ::text report("{name}; {size KBR}; {modified}", ,
"Report on <curpath>, <date><crlf>", "---");
Displays a mini-report of the current file list in a multiline
textbox.
- ::text report('The item "{name}" has {size BB}.');
These fields have nothing to do with scripting variables, hence
they are resolved whether single-quoted or not.
- ::text report('The file "{fullname}" has {size BB}.');
Displaying the full name.
- ::text report("{name} is a {dir folder|file|drive}");
Showing whether item is file, folder, or drive.
- ::text report("{zebra 1|2} - {#} {name}");
Prints "1" ("2") in front of every odd (even) line.
- ::text report("{# @@@@} {name}{zebra |<crlf>|5}");
Fill leading blanks to the line number, and add an empty line
after every 5 lines. Note that the XY variable <crlf> works
within the double-quoted argument.
- ::text report("{name}, {free %}, {total size gb}");
Mini-report for the drives listing (MyComputer node).
Remarks
~~~~~~~
- The sort order is the one currently present in the file list.
- The {#} field (line number) is not filled with the line number
each file currently has in the file list, but simply numbers the
lines in the report starting with 1. This coincides with the
actual line numbers in the file list only if the report features
all files (no just a subset of selected ones).
- You can use any number of fields in the template, and it's no
problem to use the same field more than once with different
format, as in "... {size kb} ({size bb}) ..."
- The Report() function allows you to create full blown HTML-
reports of any parts of your file system or of search results!
You may even show icons for file types if you provide the image
files and give them names that match the extension, e.g. type-
txt.gif, type-png.gif, etc. which then would be referred to like
"C:\Your\Path\type-{ext}.gif" -- yep, as simple as that!
- In cooperation with soon coming up function WriteFile() you will
be able to easily write the created reports to your harddisk.
* File List: Now, no size suffix is displayed for empty files. So,
before you have seen "0 KB", now you just see "0". It's clearer
for the eye, and even slightly more correct, as "nothing" has no
unit.
! Menu User | Manage Commands...: Sorting UDCs via drag and drop
didn't work. The item position was changed, but it was not saved
when clicking ok. Fixed.