Folders view after clicked on Favourites in Folder Tree

Here's a button which you can add to any toolbar which will show your favorites in the lister.

  • Download: View Favs.dcf (2.4 KB)
  • Select "Settings / Customize Toolbar..." from your Lister and then drag the button file to any toolbar you like.

Very simplistic and doesn't do much error checking, it ignores any favorites with duplicate names.

function OnClick(clickData)
{
	var cmd = DOpus.Create().command;
	var favs = DOpus.favorites;
	if (DOpus.FSUtil.Exists("coll://Favorites") == false) {
        cmd.RunCommand("CreateFolder \"coll://Favorites\"");
    }
    cmd.RunCommand("Delete \"coll://Favorites\\*\" REMOVECOLLECTION QUIET NORECYCLE");

    for (var eFavs = new Enumerator(favs); !eFavs.atEnd(); eFavs.moveNext()) {
        if (!eFavs.item().separator && !eFavs.item().folder && eFavs.item().path != "coll://") {
			if (DOpus.FSUtil.Exists("coll://Favorites\\" + eFavs.item().path.filepart) == false) {
            	cmd.RunCommand("Copy COPYTOCOLL=member TO=\"coll://Favorites\" FILE=\"" + eFavs.item().path + "\"");
			}
		}
		if (eFavs.item().folder && eFavs.item().path != "coll://") {
			for (var eSubs = new Enumerator(eFavs.item()); !eSubs.atEnd(); eSubs.moveNext()) {
				if (DOpus.FSUtil.Exists("coll://Favorites\\" + eSubs.item().path.filepart) == false) {
			    	cmd.RunCommand("Copy COPYTOCOLL=member TO=\"coll://Favorites\" FILE=\"" + eSubs.item().path + "\"");
				}
			}
		}
    }
    cmd.RunCommand("Go \"coll://Favorites\"");
}