Adding QuickAccess (recently edited files)

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
ThadiusIII
Posts: 1
Joined: 30 Nov 2016 06:11

Adding QuickAccess (recently edited files)

Post by ThadiusIII »

XYplorer is looking great, but I haven't been able to fully replicate the Win 10 File Explorer "Quick Access" functionality (see attachment). I understand I can use a few XYplorer mechanisms to save favorite folder paths etc., but the functionality I'm missing is the list of recently used folders and recent files. I've tried using a "finding tab" to return files modified in the past 24 hours, but that seems to perform too slowly and returns false positives (e.g. files updated by the system). Any suggestions?
To see the attached files, you need to log into the forum.

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

Re: Adding QuickAccess (recently edited files)

Post by highend »

Two ways:

1. Just drag the folder "C:\Users\%USERNAME%\AppData\Roaming\Microsoft\Windows\Recent"
onto the "Links" icon in the tree (Configuration | Tree and List | Items in Tree and List | Show Links folder must be checked)

2. Or a "more sophisticated" way by writing a script that filters that folder for unnecessary entries (everything that is not
a file or folder) which could be invoked e.g. by a hotkey and presents a (filterable) list from which you could choose...

Something like this:

Code: Select all

    $limitFileEntries = 0;
    $exclude = <<<>>>
        desktop.ini
        library-ms
>>>;
    $exclude     = regexreplace(formatlist($exclude, "t", <crlf>), "^(.)", "*$1");
    $recentItems = listfolder("%APPDATA%\Microsoft\Windows\Recent", , 1, <crlf>);
    $pattern     = regexreplace($exclude, "(#|\[)", "[$1]");
    $recentItems = formatlist($recentItems, "f", <crlf>, "!$pattern", "f");
    $countItems  = gettoken($recentItems, "count", <crlf>);

    if !($recentItems) { status "No recent files or folders found, aborted!", "8B4513", "stop"; end 1==1; }
    $max = ($limitFileEntries < $countItems) ? (($limitFileEntries) ? $limitFileEntries : $countItems) : $countItems;

    $files = "";
    $folders = "";
    while ($i++ < $max) {
        $realPath = property("#LinkTarget", gettoken($recentItems, $i, <crlf>));
        if (exists($realPath) == 2) { $folders = $folders . $realPath . <crlf>; }
        elseif (exists($realPath) == 1) { $files = $files . $realPath . <crlf>; }
    }
    $dst = inputselect("Go to / open recent folder / file", formatlist($folders . <crlf> . $files, "e", <crlf>), <crlf>, 5);
    if (exists($dst) == 2) { goto $dst; }
    else { open $dst, "w"; }
Moved the topic to "Tips & Tricks, Questions & Answers"
One of my scripts helped you out? Please donate via Paypal

klownboy
Posts: 4481
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440

Re: Adding QuickAccess (recently edited files)

Post by klownboy »

Hi highend, I hope you're doing well. That script could be very useful. I may try to modify it slightly to only display the last 10 (or whatever number) files accessed by date as opposed to alphabetical order of all of them. The next step might be to combine it with one of the recent folder menus in the Clean Recent script thread viewtopic.php?f=7&t=11458 such that we end up having a nice menu listing of recent files and recent folders.
Take care,
Ken

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

Re: Adding QuickAccess (recently edited files)

Post by highend »

Everything's all right :)

Only three changes are necessary to get the a list sorted after last used date

Code: Select all

    $limitFileEntries = 0;
    $exclude = <<<>>>
        desktop.ini
        library-ms
>>>;
    $exclude     = regexreplace(formatlist($exclude, "t", <crlf>), "^(.)", "*$1");
    $recentItems = folderreport("items:{modified yyyymmddhhnnss}|{fullname}", "r", "%APPDATA%\Microsoft\Windows\Recent", , "r", <crlf>);
    $pattern     = regexreplace($exclude, "(#|\[)", "[$1]");
    $recentItems = formatlist(formatlist($recentItems, "r", <crlf>), "f", <crlf>, "!$pattern", "f");
    $countItems  = gettoken($recentItems, "count", <crlf>);

    if !($recentItems) { status "No recent files or folders found, aborted!", "8B4513", "stop"; end 1==1; }
    $max = ($limitFileEntries < $countItems) ? (($limitFileEntries) ? $limitFileEntries : $countItems) : $countItems;

    $files = "";
    $folders = "";
    while ($i++ < $max) {
        $realPath = property("#LinkTarget", gettoken(gettoken($recentItems, $i, <crlf>), 2, "|"));
        if (exists($realPath) == 2) { $folders = $folders . $realPath . <crlf>; }
        elseif (exists($realPath) == 1) { $files = $files . $realPath . <crlf>; }
    }
    $dst = inputselect("Go to / open recent folder / file", formatlist($folders . <crlf> . $files, "e", <crlf>), <crlf>, 5);
    if (exists($dst) == 2) { goto $dst; }
    else { open $dst, "w"; }
One of my scripts helped you out? Please donate via Paypal

klownboy
Posts: 4481
Joined: 28 Feb 2012 19:27
Location: Windows 11, 25H2 Build 26200.8737 at 100% 2560x1440

Re: Adding QuickAccess (recently edited files)

Post by klownboy »

Thanks highend, that was quick...while I was still only thinking about it. :)

By the way, do know the logic as to when Windows updates that list in ...Recent? I ask because unlike XY's recent folders/locations, it doesn't have the latest folders accessed/opened via XYplorer.

babelmansour
Posts: 1
Joined: 27 Aug 2018 16:18

Re: Adding QuickAccess (recently edited files)

Post by babelmansour »

Hello,

thanks much for the script which works well. As i am a new XYplorer user, I would like to know how to create a permanent link or tab listing the recently edited folders/files.
Thanks again

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

Re: Adding QuickAccess (recently edited files)

Post by highend »

You could just open a tab and open the recent location in it (and save your settings afterwards). There is no "autoupdate" without displaying the folder contents itself, everything else requires the script...
One of my scripts helped you out? Please donate via Paypal

DaiKen
Posts: 6
Joined: 17 May 2020 17:15

Re: Adding QuickAccess (recently edited files)

Post by DaiKen »

Wonderful piece of code, but what to do after running it? I can select something from the code's output window, but that's it.
recentxy.png
Can't this output be connected to a tab?

Hope to hear from you!
To see the attached files, you need to log into the forum.

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

Re: Adding QuickAccess (recently edited files)

Post by highend »

You could load it as a paperfolder instead...
One of my scripts helped you out? Please donate via Paypal

DaiKen
Posts: 6
Joined: 17 May 2020 17:15

Re: Adding QuickAccess (recently edited files)

Post by DaiKen »

Thanks for your quick reply, highend. You mean 1) I can load the script as a paper folder, or 2) load C:\Users\name\AppData\Roaming\Microsoft\Windows\Recent as a paper folder?
2 I did, but am curious is 1 is possible.

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

Re: Adding QuickAccess (recently edited files)

Post by highend »

Replace these

Code: Select all

    $dst = inputselect("Go to / open recent folder / file", formatlist($folders . <crlf> . $files, "e", <crlf>), <crlf>, 5);
    if (exists($dst) == 2) { goto $dst; }
    else { open $dst, "w"; }
with

Code: Select all

    $folders = formatlist($folders, "sed", <crlf>);
    $files   = formatlist($files, "sed", <crlf>);
    if ($folders || $files) { paperfolder("Recent items", $folders . <crlf> . $files); }
One of my scripts helped you out? Please donate via Paypal

DaiKen
Posts: 6
Joined: 17 May 2020 17:15

Re: Adding QuickAccess (recently edited files)

Post by DaiKen »

Thanks again for your reply.
I am not new to IT and/or programming (my first lines of code stem from 1972 ;-)), but xyplorer scripting is new to me, and I didn't have had the time yet to dive into it.
Your latest suggestion 1) does work, but 2) hasn't the effect desired by me, alas. I see the same as before after running the code (which takes a while btw)
xyplorerRecent2.jpg
What am I doing wrong?
To see the attached files, you need to log into the forum.

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

Re: Adding QuickAccess (recently edited files)

Post by highend »

Don't know as long you're not posting the full script you're using now but it's rather obvious that you still have the lines in it, otherwise you wouldn't get a window with the "Go to / open recent folder / file" title
One of my scripts helped you out? Please donate via Paypal

DaiKen
Posts: 6
Joined: 17 May 2020 17:15

Re: Adding QuickAccess (recently edited files)

Post by DaiKen »

You are absolutely RIGHT! I made a copy of the original file, changed the lines, but forgot to update my Commands...
It's looking great now:
xyplorerRecent3.jpg
Time to unlock the trial version, buy you a beer or a coffee and get into scripting myself, ThnX!
To see the attached files, you need to log into the forum.

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

Re: Adding QuickAccess (recently edited files)

Post by highend »

A modernized version:
Show recent items [paperfolder]_v0.3.xys
- Correct deduplication of entries
- Skip network paths if shift key is hold when the script is executed (may not work from the catalog)
- Open in a new tab instead of the current one
- Automatic sort by last modified date

Regarding the slowness of the script:
Normally caused by non existing / non reachable items, mostly UNC paths.
Hence the option to include them only with the shift key pressed.
buy you a beer
My paypal address is in my signature :masked:
To see the attached files, you need to log into the forum.
One of my scripts helped you out? Please donate via Paypal

Post Reply