For created, modified and accessed
Either as an inputlist or a menu.
If you generally have a lot of visible items I'd choose the inputlist, otherwise the menu can be too long to be really usable...
Code: Select all
$useWindow = true; // true or false. If false: Use a menu instead
// Remove date (only!) filter if already present
if (regexmatches(get("livefilter"), "^dateC: [0-9-]{10}$")) { filter "", 8; end true; }
// Abort immediately
end (!<allitems>), "No visible item(s), aborted!";
$report = report("{created yyyy-mm-dd}|{modified yyyy-mm-dd}|{accessed yyyy-mm-dd}<crlf>");
$dateType = popupmenu("Created|Modified|Accessed");
if ($dateType) {
$result = GetDate($report, $dateType);
if ($useWindow) { $select = inputselect("Choose date", $result, <crlf>, 32+8192+16384, , 250, 400); }
else { $select = popupmenu($result, 6:=<crlf>); }
if ($select) {
if ($dateType LikeI "Created") { filter "dateC: $select", 8; }
elseif ($dateType LikeI "Modified") { filter "dateM: $select", 8; }
elseif ($dateType LikeI "Accessed") { filter "dateA: $select", 8; }
}
}
function GetDate($report, $type) {
$pattern = "^([0-9-]+?)\|([0-9-]+?)\|([0-9-]+?)$";
if ($type LikeI "Created") { $result = regexreplace($report, $pattern, "$1"); }
elseif ($type LikeI "Modified") { $result = regexreplace($report, $pattern, "$2"); }
elseif ($type LikeI "Accessed") { $result = regexreplace($report, $pattern, "$3"); }
return formatlist($result, "red", <crlf>);
}