Code: Select all
Focus 'List';
Which means the next easiest option is to Filter the list, which changes the focus, selection, scrolling, etc.
Give this script a try:
Code: Select all
"Select Numbered Base"
//If no selection select the focused item first.
if (Get('CountSelected') < 1) {
Sel '+0';
}
//Sanity check that something is selected.
End Get('CountSelected') < 1, 'No item selected...';
$base = "<curbase>";
$ext = "<curext>";
//<cur...> only works on the focused and selected item.
End "$base" Like '', 'Focused item is not selected...';
//Strip numbers from the end
$base = RegexReplace("$base", '^(.*?)(\d+)$', '$1');
//Get list of files matching this base.
$list = ListPane('a', "$base*", 5);
//Rebuild the list of matches (ListPane may return items that matched more than we wanted)
//Base = "test.part"
//ListPane would include "test.part1.invalid.rar|test.part1.rar"
$results = '';
$pattern = "^$base\d+\.$ext$";
foreach ($token, "$list") {
$match = RegexReplace("$token", "$pattern", ':MATCH:');
if ("$match" Like ':MATCH:') {
$results = "$results|$token";
}
}
//Clean up the list.
$results = FormatList("$results", 'ted');
//Select the items without changing focus.
SelectItems "$results", 0, 0;
//Refocus the list.
Focus 'List';