1. Create a script file named as SortFavorites.xys in your script folder:
Code: Select all
#182; // Save All Settings
getkey $count, "Count", "Favorites";
// Find the last separator
$last_separator = 0;
$i = $count;
while ($i > 0) {
getkey $value, "Fav".$i, "Favorites";
if ($value == "-") {
$last_separator = $i;
break;
}
$i--;
}
// Sort and write back to ini
$i = $last_separator + 1;
while ($i < $count) {
getkey $vi, "Fav".$i, "Favorites";
$min_index = $i;
$min_value = $vi;
$j = $min_index + 1;
while ($j <= $count) {
getkey $vj, "Fav".$j, "Favorites";
if ($vj < $min_value) {
$min_index = $j;
$min_value = $vj;
}
$j++;
}
if ($min_index != $i) {
setkey $min_value, "Fav".$i, "Favorites";
setkey $vi, "Fav".$min_index, "Favorites";
}
$i++;
}
#190; // Restart without Saving
There is a related XYplorer bug: http://www.xyplorer.com/xyfc/viewtopic.php?f=2&t=3830
Workaround: Call this script from non-context menu, for example, Favorite Folders sub-menu from main menu, or User-defined commands
XYplorer Beta Club