MultiCommander v3.1 contains support for rule based coloring of file items.
However this feature is experimental and there is no user interface for configure the rules, Yet.
(Since it is experimental, Fell free to reply with feedback with ideas, tips and request on how this should work or be improved)
However. You can setup the rule based coloring using Multi-Script. And the colors is not kept between restarts you can load that script automatic during startup, or button or hotkey or whatever you want,
And since it is script based you can have different color setup and change between then with a command that you call.
To enable Rule bases file coloring you must first enable it in settings
Menu > Configuration > Explorer Panel Settings > Colors (tab)
Before the configuration for the existing Color of file/folder based on file/folder name there is a new options
[.] (Experimental) Rule based coloring of file and folders
(This settings will disabled the other file/folder coloring)
Configure Colors
All the rule based file coloring is done from 4 Multi-Script functions
FileColoringClear(); = Removes all Rules
FileColoringAddRule(...); = Add a Rule
FileColoringSetColor(...); = Set Color To a rule
FileColoringRefresh(...); = Refresh the coloring system with
You can combine multiple rules and if all of the nested rules are true, Only then is the color set.
All the rule are matches from the first to the last inserted rule. If a match is found for a file it will then
stop searching for another rule to match. So if you having trouble getting the correct color it might be because of the order
the rules are setup.
You first create a rule using FileColoringAddRule(...) and it will return a "rule handle" you then use that rule handle to set a color.
FileColoringAddRule(<parent rule if any, else 0> , <field> , <match type> , <value> );
When settings a color to a rule, you can specify both a text and background color. However the background color is only shown IF the options
"Use file specified background color" / "Use folder specified background colors" are enabled.
And to use the default background color use an empty string as background color.
eg.
FileColoringSetColor( $rule , "#FF0000" , "" ); // Use the default specified background color.
Example.
// First we need to remove all existing rules. DO NOT FORGET TO DO THIS.
FileColoringClear();
// variable to store Rule in
@var $rule = 0;
// Add Rule - if file extension is jpg, bmp, png, or gif
$rule = FileColoringAddRule(0, "Ext" , "Is", "jpg|bmp|png|gif" );
FileColoringSetColor( $rule , "#FF0000" , "#00FF00" );
// Add Rule - if file extension is zip , rar or 7z
$rule = FileColoringAddRule(0, "Ext" , "Is", "zip|rar|7z" );
FileColoringSetColor( $rule , "#FF9954" , "#00FF00" );
// Add Rule - match the namepart using wildcard against *-Invoice-201?-*
$rule = FileColoringAddRule(0, "namepart" , "wildcard", "*-Invoice-201?-*" );
FileColoringSetColor( $rule , "#4455FF" , "#00FF00" );
// Add Rule - match substring from the full filename will match "MyFile_abcdef.txt" and "myFile.edf"
$rule = FileColoringAddRule(0, "Fullname" , "contains", "edf" );
FileColoringSetColor( $rule , "#44FFFF" , "#00FF00" );
/ Add Rule - if file has readonly attribute set
$rule = FileColoringAddRule(0, "attribute" , "has", "r" );
FileColoringSetColor( $rule , "#FF2277" , "" );
// Add Rule - If file size is more then 10.000.000 bytes
$rule = FileColoringAddRule(0, "Size" , "MoreThen", "10000000" );
FileColoringSetColor( $rule , "#BB9988" , "#00FF00" );
// Add Rule - If date is before 2013-01-01 00:00:00 (Date MUST be ISO formatted.)
$rule = FileColoringAddRule(0, "Date" , "Before", "2013-01-01 00:00:00" );
FileColoringSetColor( $rule , "#444433" , "#00FF00" );
// Add Rule - Combine two rules.
// if Size is MoreThen 10.000 bytes AND file extension is "txt"
$rule = FileColoringAddRule(0, "Size" , "MoreThen", "10000" );
$rule = FileColoringAddRule($rule, "Ext" , "Is", "txt" );
FileColoringSetColor( $rule , "#FF3299" , "#00FF00" );
// Revalidate all file coloring.
FileColoringRefresh();
Current supported Field
Fullname
Namepart
Ext
Size
Date
Attribute
= More to be added, for example extended file properties provided by extension. (Like they are used by MultiRename )
Match Type
Is - If a string or numeric values matches exactly (String match is not case sensitive) (Fullname,namepart,ext,size)
Wildcard - If a wildcard value matches (Fullname,namepart,ext)
RegExp - If regular expression matches ( Fullname,namepart,ext) (Not Implemented yet)
Contains - If a substring exists (Fullname,namepart,ext)
Beginwith - If a string begin with...
Endswith - if a string ends with...
LessThan - If a numeric value is less then specified value (Like size)
MoreThan - If a numeric value is more then specified value (Like size)
Before - If a date value is before specified value
After - If a date value is after specified value
Has - If any of the specified flags are set. (used for attribute, "arshdl" flags are supported )
HasNot - If any of the specified flags are NOT set (From Build 1412+)
= More matching type will be added
Attributes
When matching attribute you will use Has or HasNot as matchtype and as value you specify what attributes you want to check
and if any if them is found then the rule is true.
a - Archive flag
r - Readonly
s - System
h - Hidden
d - Directory / folder
l - Reparse point
c - compressed
e - encrypted
o - offline
1 - shortcut (lnk)
2 - shortcut (lnk) to folder
3 - symlink
4 - junction
5 - mount point
6 - network server
7 - network share
Example
// Has Readonly attribute
$rule = FileColoringAddRule(0, "Attribute" , "Has", "r" );
// Has System or Hidden attribute
$rule = FileColoringAddRule(0, "Attribute" , "Has", "sh" );
// DO NOT have archive attribute
$rule = FileColoringAddRule(0, "Attribute" , "HasNot", "a" );
Date Range (From build 1412+)
If you set field to "date" and use any Match Type of the following Is, LessThan or MoreThan then you can add rule like
Using LessThan/MoreThan you can specify X number of hours / days / weeks / months old.
for match value use number first then add h for Hour , d for day, w for weeks and m for months
Example
// More than 2 days old
$rule = FileColoringAddRule(0, "Date" , "MoreThan", "2d" );
// More than 48 hours old
$rule = FileColoringAddRule(0, "Date" , "MoreThan", "48h" );
// Less than 2 week
$rule = FileColoringAddRule(0, "Date" , "LessThan", "2w" );
Be aware. "2d" and "48h" are NOT the same. Day matching will match days from current day. not current hour. so "1d" is current day only.
Using "Is" as Match Type you can specify Today, Yesterday, ThisWeek, ThisMonth, ThisYear.
// Rule for today
$rule = FileColoringAddRule(0, "Date" , "Is", "Today" );
// Yesterday.
$rule = FileColoringAddRule(0, "Date" , "Is", "Yesterday" );
// Current week. (will use regional settings in computer to figure out if first day of week is sunday or monday )
$rule = FileColoringAddRule(0, "Date" , "Is", "ThisWeek" );
// Current month
$rule = FileColoringAddRule(0, "Date" , "Is", "ThisMonth" );
// Current year
$rule = FileColoringAddRule(0, "Date" , "Is", "ThisYear" );
Updated 2013-05-24 - MC 3.1.1 Beta b1412,
Added info about date additions in It now allows date rules for x days old, x weeks old or rule for today, thisweek and so on.
MatchType HasNot to be used for attributes rules added.
more file attributes not supported