Request:list favourites and existing drives in one menu

Discuss and share scripts and script files...
Post Reply
yusef88
Posts: 1148
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

Request:list favourites and existing drives in one menu

Post by yusef88 »

can script achieve this?
To see the attached files, you need to log into the forum.

highend
Posts: 14940
Joined: 06 Feb 2011 00:33
Location: Win Server 2022 @100%

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

Post by highend »

The second part consists of your current favorite folders? If that's true show a screenshot of
Menu - Favorites - Manage Favorite Folders...
One of my scripts helped you out? Please donate via Paypal

yusef88
Posts: 1148
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

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

Post by yusef88 »

Yes it is
what's strange about it?
To see the attached files, you need to log into the forum.

TheQwerty
Posts: 4373
Joined: 03 Aug 2007 22:30

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

Post 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.

yusef88
Posts: 1148
Joined: 28 Jan 2013 03:50
Location: Windows 8.1 32-bit

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

Post by yusef88 »

the second script is exactly what i want thanks

Post Reply