Is there any method that can be used to search for a word in the Catalog?
Mine is getting large and while it is a nifty feature sometimes forget what Category an operation was placed in. The right click menu shows many useful features like Sort but not any mention of how to locate.
Searching the Catalog
-
highend
- Posts: 14994
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Searching the Catalog
You could convert the catalog.dat from HEX to ASCII, strip all control characters and then search the result 
One of my scripts helped you out? Please donate via Paypal
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: Searching the Catalog
You can use a script to display and then filter catalog entries, but I cannot think of a way to trigger or jump to an entry after selecting one:
Code: Select all
"Filter Catalog"
$catalog = CatalogReport("C:{Caption}", "I:{Caption}");
$category = '';
$list = '';
foreach($line, $catalog, <crlf>) {
$type = GetToken($line, 1, ':', 't');
$caption = GetToken($line, 2, ':', 't', 2);
if ($type == 'C') {
$category = $caption;
} else {
$list = $list . "$category > $caption<crlf>";
}
}
InputSelect('Your Catalog...', $list, <crlf>, 4+64);-
Irwin of Upton
- Posts: 131
- Joined: 28 Feb 2015 19:42
Re: Searching the Catalog
Thank you, thank you Mr. Qwerty! The script you so generously took the time to code does the job. It is like having a GPS device for the Catalog. Once run the magnifying glass is given the desired destination and then knowing its location "driving there" is easy.
An ingenious solution.
An ingenious solution.
-
highend
- Posts: 14994
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Searching the Catalog
This slightly modified version removes some imho unnecessary clutter (mainly the display of icon information when there is a "valid" caption)...
Code: Select all
$catalog = CatalogReport("C:{Caption}", "I:{Caption}");
$category = '';
$list = '';
$captionCnt = 1;
foreach($line, $catalog, <crlf>) {
$type = GetToken($line, 1, ':', 't');
$caption = GetToken($line, 2, ':', 't', 2);
if (gettoken($caption, 1, "|")) {
$caption = regexreplace($caption, "\|.*");
}
if ($type == 'C') {
if ($captionCnt == 1) {
$list = $list . recase($caption, "u") . "...<crlf>";
} else {
$list = $list . <crlf> . recase($caption, "u") . "...<crlf>";
}
$captionCnt++;
} else {
$list = $list . " $caption<crlf>";
}
}
InputSelect('Your Catalog...', $list, <crlf>, 4+64);
One of my scripts helped you out? Please donate via Paypal
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: Searching the Catalog
@highend: nice! This might be slightly cleaner code:EDIT: Really unfortunate that the regexreplace cannot convert case so we could remove the loop.
/edit
Caused me to play a bit, I preferred keeping it similar to List All Commands but inserting a separator between categories:
Code: Select all
"Filter Catalog"
$catalog = CatalogReport("C:{Caption}...", " {Caption}");
$category = '';
$list = '';
foreach($line, $catalog, <crlf>) {
if ($line Like 'C:*') {
$line = SubStr(Recase($line, 'u'), 2);
if ($list != '') { $list = $list . <crlf>; }
} else {
$line = GetToken($line, 1, '|');
}
$list = $list . $line . <crlf>;
}
InputSelect('Your Catalog...', $list, <crlf>, 4+64);Caused me to play a bit, I preferred keeping it similar to List All Commands but inserting a separator between categories:
Code: Select all
"Filter Catalog"
$catalog = CatalogReport("C:{Caption}", " | {Caption}");
$category = '';
$list = '';
foreach($line, $catalog, <crlf>) {
if ($line Like 'C:*') {
$category = SubStr($line, 2);
if ($list != '') {
$list = $list . StrRepeat('-', 80) . <crlf>;
}
} else {
$list = $list . $category . GetToken($line, 2, '|',, 1) . <crlf>;
}
}
InputSelect('Your Catalog...', $list, <crlf>, 4+64);-
highend
- Posts: 14994
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Searching the Catalog
Yeah, we really need an inbuild better regex engine than the ancient vbscript.dll one...Really unfortunate that the regexreplace cannot convert case so we could remove the loop.
I modified my code 2-3 times (to make it look a bit nicer (and to reimplement the display of the second (icon) part of the caption if the first part is empty)
It's a curse that the moderator edits aren't displayed, isn't it
One of my scripts helped you out? Please donate via Paypal
-
TheQwerty
- Posts: 4373
- Joined: 03 Aug 2007 22:30
Re: Searching the Catalog
Nope, not at all. In fact, that's my favorite feature of the forum!highend wrote:It's a curse that the moderator edits aren't displayed, isn't it
-
highend
- Posts: 14994
- Joined: 06 Feb 2011 00:33
- Location: Win Server 2022 @100%
Re: Searching the Catalog
Pssssssst, I've just edited your post! *eg*Nope, not at all. In fact, that's my favorite feature of the forum!
One of my scripts helped you out? Please donate via Paypal
-
kunkel321
- Posts: 664
- Joined: 10 Jun 2012 03:45
- Location: Near Seattle
Re: Searching the Catalog
You two are a hoot!
ste(phen|ve) kunkel
Scaling: Main monitor 125%, Secondary monitor on the right 100%
OS: Win 10. XYplorer version: Latest beta, unless specified.
Scaling: Main monitor 125%, Secondary monitor on the right 100%
OS: Win 10. XYplorer version: Latest beta, unless specified.
XYplorer Beta Club