Add profiles functionality to favorites

Features wanted...
Post Reply
mr9bitbyte
Posts: 1
Joined: 10 Nov 2023 15:26

Add profiles functionality to favorites

Post by mr9bitbyte »

I love the favorite folder/files. But I often use them for specific projects and changed them based on a project that I find myself going back to. It'd be nice to have the option to have different "profiles" in which a group of favorite files or folders are loaded depending on the profile used, if you are working on a different project, you can change the favorite files/folders being used depending on the profile selected. I think this would be a very useful functionality.

admin
Site Admin
Posts: 65390
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Add profiles functionality to favorites

Post by admin »

a) Check out the command line switch /ini in the Help file.

OR

b) Check out the scripting command loadsettings.

Horst
Posts: 1354
Joined: 24 Jan 2021 12:27
Location: Germany

Re: Add profiles functionality to favorites

Post by Horst »

I support mr9bitbyte's wish.
/ini parameter or scripting makes things too complicated.
1. Different ini-files would mean, all other setting changes must be made in all ini-files.
2. Loadsettings doesn't allow to just load new favorites.
Windows 11 Home, Version 25H2 (OS Build 26200.7462)
Portable x64 XYplorer (Actual version, including betas)
Display settings 1920 x 1080 Scale 100%
Everything 1.5.0.1404a (x64), Everything Toolbar 2.1.1, Listary Pro 6.3.6.99

jupe
Posts: 3323
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Add profiles functionality to favorites

Post by jupe »


admin
Site Admin
Posts: 65390
Joined: 22 May 2004 16:48
Location: Win8.1, Win10, Win11, all @100%
Contact:

Re: Add profiles functionality to favorites

Post by admin »


Horst
Posts: 1354
Joined: 24 Jan 2021 12:27
Location: Germany

Re: Add profiles functionality to favorites

Post by Horst »

The script solution with toggling 2 sets is fine for normal usage
but not applicable for project management related favs.
Who has only 2 projects ?
Windows 11 Home, Version 25H2 (OS Build 26200.7462)
Portable x64 XYplorer (Actual version, including betas)
Display settings 1920 x 1080 Scale 100%
Everything 1.5.0.1404a (x64), Everything Toolbar 2.1.1, Listary Pro 6.3.6.99

jupe
Posts: 3323
Joined: 20 Oct 2017 21:14
Location: Win10 22H2 120dpi

Re: Add profiles functionality to favorites

Post by jupe »

The link was to a post mentioning that the scripting command is already available, demoing that users can already script XY to load any number of different sets of favorites, no one is forcing you to to use that pre-made script.

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

Re: Add profiles functionality to favorites

Post by highend »

Unlimited profiles...

Code: Select all

    $dst = "<xydata>\Favorites";
    if (exists($dst) != 2) { new($dst, "dir"); }

    $favFiles = listfolder($dst, "*.txt", 1+4, <crlf>);
    $mouseBtn = <get trigger mousebtn>;

    // Left click (load profile)
    if ($mouseBtn == 1) {
        end ($favFiles == ""), "No profile(s) yet, aborted!";

        $menu = replace($favFiles, ".txt");
        $sel  = popupmenu($menu, 6:=<crlf>);
        if ($sel) {
            $cntFiles   = 0;
            $cntFolders = 0;
            $favFile    = $sel . ".txt";
            $content    = readfile("$dst\$favFile", , , 65001);
            $files      = regexmatches($content, "^\[Files\](\s|\S)+?^\[");
            if ($files) {
                $files    = trim(regexreplace($files, "^\[.*?(\r?\n|$)"), <crlf>);
                $cntFiles = gettoken($files, "count", <crlf>);
                favs("f", $files, , "s");
            }
            $folders = regexmatches($content, "^\[Folders\](\s|\S)+");
            if ($folders) {
                $folders    = trim(regexreplace($folders, "^\[.+?\](\r?\n)"), <crlf>);
                $cntFolders = gettoken($folders, "count", <crlf>);
                favs("d", $folders, , "s");
            }
            if ($files == "" && $folders == "") {
                status "No favorites in profile, aborted!", "8B4513", "stop";
                end true;
            }
            status ($cntFiles + $cntFolders) . " favorites loaded from " . quote($sel);
        }

    // Right click (save profile)
    } elseif ($mouseBtn == 2) {
        // Show all existing profile (files) and one entry to create a new one
        $favFiles = replace($favFiles, ".txt");

        $menu = "Save as a new profile";
        if ($favFiles != "") { $menu .= <crlf> . "-" . <crlf> . $favFiles; }

        $files   = favs("f");
        $folders = favs("d");
        end ($files == "" && $folders == ""), "No favorites defined, aborted!";

        $sel = popupmenu($menu, 6:=<crlf>);
        if ($sel == "Save as a new profile") {
            $fileName = input("Enter filename, WITHOUT extension!", , "Work");
            end ($fileName == ""), "Empty name entered, aborted!";

            $fileName .= ".txt";
            step; // DEBUG
            if (exists("$dst\$fileName") == 1) {
                if !(confirm("Profile already exists, overwrite?", , , 1+32)) { end true; }
            }
            WriteFavFile("$dst\$fileName", $files, $folders);

        } elseif ($sel != "") {
            $fileName = $sel . ".txt";
            WriteFavFile("$dst\$fileName", $files, $folders);
        }
    }

function WriteFavFile($file, $favFiles, $favFolders) {
    $content = "[Files]" . <crlf> . $favFiles . <crlf 2> . "[Folders]" . <crlf> . $favFolders;
    writefile($file, $content, , "utf8");
}
One of my scripts helped you out? Please donate via Paypal

Horst
Posts: 1354
Joined: 24 Jan 2021 12:27
Location: Germany

Re: Add profiles functionality to favorites

Post by Horst »

jupe wrote: 10 Nov 2023 20:20 The link was to a post mentioning that the scripting command is already available, demoing that users can already script XY to load any number of different sets of favorites, no one is forcing you to to use that pre-made script.
That's clear, but there are too many basic functions which can only be solved by additional scripting.
For me, this is a typical example where Don should make an integrated solution.
Windows 11 Home, Version 25H2 (OS Build 26200.7462)
Portable x64 XYplorer (Actual version, including betas)
Display settings 1920 x 1080 Scale 100%
Everything 1.5.0.1404a (x64), Everything Toolbar 2.1.1, Listary Pro 6.3.6.99

Horst
Posts: 1354
Joined: 24 Jan 2021 12:27
Location: Germany

Re: Add profiles functionality to favorites

Post by Horst »

highend wrote: 10 Nov 2023 21:34 Unlimited profiles...
Thanks
Windows 11 Home, Version 25H2 (OS Build 26200.7462)
Portable x64 XYplorer (Actual version, including betas)
Display settings 1920 x 1080 Scale 100%
Everything 1.5.0.1404a (x64), Everything Toolbar 2.1.1, Listary Pro 6.3.6.99

Post Reply