Match possibility with wildcards - ala reverse like
Posted: 15 Mar 2015 09:12
Not sure if this would be possible. Take below unfinished code (which is partly from the Qwerty) as example to take leverage of the CEA scripting.
The pathsExact matching is done in an elegant manner using formatlist as I can pass the list of exact paths and filter the current path. However, for wild card patterns, I have to fall back on a foreach loop. Can that be achieved in some other way - missing switch case
The pathsExact matching is done in an elegant manner using formatlist as I can pass the list of exact paths and filter the current path. However, for wild card patterns, I have to fall back on a foreach loop. Can that be achieved in some other way - missing switch case
Code: Select all
"CEA"
$main = "Fav Folders;550 | Fav Files;564 | Favorites;_favsFull | - | Drives;526 | Drives+Special;_drivesSpecial | - | All Tabs;690 | Pane Tabs;538" ;
$pathsExact = "Recycle Bin | Empty Recycle Bin;642|_|paper:Cloud | Empty Paper Folder;777" ;
$pathsWild = "paper* | Empty Paper Folder;777|_|*Downloads* | Show Drives;526" ;
$match = formatlist($pathsExact, f, "|_|", "<curpath>*") ;
if ($match) {
$main = $main . " |" . gettoken($match, 2, "|") ; //First match wins
} else {
$pattern = "paper*|*Downloads*" ;
foreach ($path, $pattern, "|") {
if (<curpath> LikeI "$path") {
$match = formatlist($pathsWild, f, "|_|", "$path") ;
$main = $main . " |" . gettoken($match, 2, "|") ; //First match wins
break ;
}
}
}
if (get("FocusedControl") == "T") {
#690;
} else {
$choice = popupmenu($main, -1, -1, 1, -1, 0, " | ", ";", "Esc") ;
end ($choice == "Esc") ;
if ($choice Like "_*") {
sub "$choice";
} else { #$choice; }
}
"_favsFull"
popupmainmenu 'favorites';
"_drivesSpecial"
$sub=get("Drives", ," | ") . " | " . %computer% . " | " . %personal% . " | " . %net% . " | " . %recycler% ;
$choice = popupmenu($sub, -1, -1, 1, -1, 0, " | ", ";", "Esc") ;
end ($choice == "Esc") ;
goto "$choice";