Page 1 of 1

Request:list favourites and existing drives in one menu

Posted: 16 Jun 2016 14:24
by yusef88
can script achieve this?

Re: Request:list favourites and existing drives in one menu

Posted: 16 Jun 2016 15:15
by highend
The second part consists of your current favorite folders? If that's true show a screenshot of
Menu - Favorites - Manage Favorite Folders...

Re: Request:list favourites and existing drives in one menu

Posted: 16 Jun 2016 15:28
by yusef88
Yes it is
what's strange about it?

Re: Request:list favourites and existing drives in one menu

Posted: 16 Jun 2016 15:32
by TheQwerty
Currently it would require reading the favorites from <xyini> and dealing with the fact that they might be stale.
(One day there might be a better way.)


My suggestion for now is to show drives and then favorites in sub-menus:

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';

If you really wanted to use the data from the INI file you could try this:

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';

The big challenge is converting the favorites into a working script menu given all of the things that favorites supports.

Re: Request:list favourites and existing drives in one menu

Posted: 16 Jun 2016 17:43
by yusef88
the second script is exactly what i want thanks