I've developped this (external) addon to automate a one-click assigning color to selected File(s)/Folder(s) (~ "Define colors by file type"), by updating the [Colors] & [searches] TC .ini sections on the fly: Panels with colored file/folder
This is my first user contribution to "addon to TC", hope this helps... all remarks are welcome!
Note: there is only one point as, for each color applied action, TC .ini file is updated, thus, TC must be (force) restarted to take into account changes (*) (see my suggestion post: viewtopic.php?t=77800 )
Version 2023.1.13.2 32/64
URL: TC_PatternColor (use the upper right download arrow/button) // md5: 043fe51ac3fe0329afc0f3d3778c6440 *TC_PatternColor.exe
Note:
+ Backup of .ini files has been disabled by default, to reactivate it: set TCIniFileBkpBeforeModif=1 and TCIniFileBkpBeforeModifWarnOnBkpError=1
+ To prevent from TC restart: Set TCExitAndRestart=0 (& possibly TCExitBeforeModif=0 & TCExitAlsoAnyOtherRunningTC=0 & TCRestartAfterModif=0)
+ To avoid ESC message popup: Set TCColorGUI_MsgOnESC=0
Optional: here my ".ico" folder icon pack (if needed...)
Features
+ Add a "/R %S" parameter option to raise the "Color picker" popup & directly ask user for color to apply to selected file/folder (ie: no more need to specify any "Color name" on command line

+ Improve "/L" and add "/C" parameters => execute one time the "TC_PatternColor.exe" file to get help
+ When select file(s)/folder(s) in a TC Panel, on button click, a color is applied (& TC .ini updated), then, TC is restared to take into account changes (*)
+ If double-click on the exe, a button example is copied in your clipboard => to paste into your TC bar
+ List actual matching Color <-> file/Folder patterns (can be full name, or extension only)
+ If it's an unknown color, a popup is raised to user on button click, to create it
+ Debug dump improved (if set DEBUG=1)
+ Modified 1 parameter:
-- TCIniFileBkpBeforeModif=0 => Backup of .ini files set to *NO* by default (can change it to =1 to perform backup again, of *ALL* possible .ini files (like "redirection" ones too))
+ Added 2 new parameters in .ini :
-- TCIniFileBkpBeforeModifWarnOnBkpError=0 => (only active if TCIniFileBkpBeforeModif=1): if set to 1 and an error occurs during copy => warn user
-- TCKeyAddSearchInAndText=0 => to NOT add extra keys "PatternColorXxx_SearchIn=" & "PatternColorXxx_SearchText="
+ Do NOT handle duplicate values (ex: Selected Dummy.xyz and FileName.xyz => got same <ext> => if 1st already processed, do not process the next same ones)
+ Huge improvement regarding "Redirections" ([Colors] & [searches] sections)
++ Handle Redirection .ini file check, in this order: search & check 1st localy (~script folder), then in "given" TC .ini path, then in TC .exe path (COMMANDER_PATH)
+ Handle the "*." problems, linked to a "PatternColor<Xyz>_SearchFor=" field that may remains empty
++ Added also TCKeyValueEmptyAddPrefix="<" & TCKeyValueEmptyAddSuffix=">" as parameters to add in the "last" pattern (whenever having remove "all ones" => as "<" and ">" are not allowed chars. for names/folders, this type of search will never be reached & prevents to have a "PatternColor<Xyz>_SearchFor=" empty)
Screenshots:
- View TC file/folder colored panels on my side : Panels with colored file/folder (filter applied to File/Folder extension or name)
- On the opposite, here a default view TC Panels NOT colored (switched with command: "cm_SwitchColorsByFileType")
- Popups Help dialog box (if double-click on script) & List Color & actual defined Patterns
- TC Button example & Color picker (there, for the unknown "PatternColorBlue" color)
-------
Installation (one time):
- Download last version for TC_PatternColor.exe & .ini files, then uncompress it locally in a folder
- Inside TC, run (execute) "TC_PatternColor.exe" at least one time => to get in your clipboard an example of a TC button (& an additional help popup)
- Then, on your TC button bar -empty zone-, you can right-click & paste the new button !
Usage:
1. Select one or more file(s)/folder(s) in a TC panel (usually, via the right mouse button)
2. Then, click on the button in your TC bar
=> the app will set/unset (or request) color to the selected File/Folder extention or name (depending on configuration: /E or /N) & restart TC (*)
How to create new "color" buttons:
- You can simply duplicate a button & (only) change the "PatternColorXxx" name in field "Parameters" (keep unchanged the "/E" (or "/N") and "%S" parameters)
=> to create new button Pattern colors (as explained, the color will be asked to user on first usage)
Actions performed by the app, on a button click:
- Current TC Position/Configuration/History is saved (see "TCForceSaveConf=1" in config .ini file)
- Current TC .ini file is backuped (see "TCIniFileBkpBeforeModif=1" in config .ini file)
- If the "Color" is unknown (first usage), a user request/color picket to choose popup is performed
- For selected File/Folder extension, the color is assigned (added/matching keys from [Colors] & [searches] sections from your TC .ini file)
- TC is restarted (*), to take into account color/pattern changes (see "TCExitAndRestart=1" in config .ini file)
Note:
- You can configure this tool by editing its "TC_PatternColor.ini" file. Main parameters are:
-- TCForceSaveConf=1
-- TCIniFileBkpBeforeModif=1
-- TCExitAndRestart=1
-- TCColorFilterPrefix=PatternColor
- Whenever get any problem with your TC .ini file, you can rollback/restore it from ".ini.bkp/" folder (take the last dated one, an rename/copy it back in place, usually into: %USERPROFILE%\AppData\Roaming\GHISLER\)
-------
(*) TC is a mandatory restarted, as there is no internal command to re-read [Colors] & [searches] sections form TC .ini file (can avoid with "TCExitAndRestart=0")... see my suggestion post: viewtopic.php?t=77800
