Request:list favourites and existing drives in one menu
Posted: 16 Jun 2016 14:24
can script achieve this?
Forum for XYplorer Users and Developers
https://www.xyplorer.com/xyfc/
Code: Select all
"Drives + Favorites"
// FYI: Remote/network drives can make this whole script slow due to XY retrieving their icons.
$drives = Get('Drives', /*type*/, <crlf>);
//Favorites | Favorite Folders | - submenu -
$favFolderCaption = Get('MenuCaption', 550, 1+4);
Load <<<SCRIPT
$drives
-
"$favFolderCaption|:favs" #550;
SCRIPT
,, 's';Code: Select all
function favs($type) {
Assert $type LikeI '[df]', '$type must be "f" or "d".';
if ($type LikeI 'f') {
$type = 'FavFiles';
} else {
$type = 'Favorites';
}
$favs = GetSectionList($type);
// Remove count and clean up list.
$favs = FormatList($favs, 'fdents', <crlf>, '!Count*');
// Reduce to values.
$favs = RegexReplace($favs, '^Fav\d+=');
// Remove quotes and empties.
$favs = FormatList($favs, 'ue', <crlf>);
return $favs;
}
"Drives + Favorites"
// FYI: Remote/network drives can make this whole script slow due to XY retrieving their icons.
$drives = Get('Drives', /*type*/, <crlf>);
// Uncomment to save first and ensure data is always accurate.
// savesettings 1;
$favs = favs('d');
Load <<<SCRIPT
$drives
-
$favs
SCRIPT
,, 's';