Ok, an example of how this could be done:
1. Make sure permanent variables are enabled:
Configuration | Refresh, Icons, History | Scripting | Remember permanent variables
2. Save the script (at the bottom) in the XY scripts folder and give it the name "LabelLastOpened.xys"
Copy the script 1:1, all lines are indented by at least 4 spaces!
To get to the scripts folder use Menu - Scripting - Go to Scripts Folder
3. Menu - Tools - List Management - Portable File Associations...
Add a new entry like:
Code: Select all
avi;mkv>::load "LabelLastOpened.xys";
Make sure you've used the same script name as in 2.
Edit the associations if necessary (e.g. avi;mkv;mp4;mpeg...)
4. Edit the color values in the script ($color1, $color2, $color3) if necessary
5. Edit the $limitToFolder variable if necessary. For example if the whole highlightning
should only happen to files in "D:\Movies" (and all of it's subfolders) use:
$limitToFolder = "D:\Movies";
If there shouldn't be any path limitation, leave the variable empty as it is.
6. It should work (not heavily tested...)
Code: Select all
perm $P_LastOpened;
// 1 = Red, 2 = Orange, 3 = Yellow, 4 = Green, 5 = Blue, 6 = Purple, 7 = Grey
$color1 = 4;
$color2 = 2;
$color3 = 6;
$limitToFolder = "";
// Limit to a specific folder (+ subfolders of it)
if ($limitToFolder && strpos(gpc(<pfaitem>, "path"), $limitToFolder) == -1) { end 1==1; }
$curColor = tagitems("label", , <pfaitem>);
$P_LastOpened = ModifyList($P_LastOpened, <pfaitem>);
while ($i++ < gettoken($P_LastOpened, "count", "|")) {
$item = gettoken($P_LastOpened, $i, "|");
$color = ($i == 1) ? $color1 : (($i == 2) ? $color2 : $color3);
tagitems("label", $color, $item);
}
writepv;
savesettings 64;
open <pfaitem>, "w";
function ModifyList($list, $item) {
if !($list) { return $item; }
elseif ($item == gettoken($list, 1, "|")) { return $list; }
elseif (gettoken($list, "count", "|") == 3) {
tagitems("label", "", gettoken($list, 3, "|"));
$list = $item . "|" . gettoken($list, 2, "|", , 1);
} else { $list = $item . "|" . $list; }
return $list;
}