Page 1 of 1
Fetch recently opened items and present in a toolbar menu
Posted: 20 Nov 2013 11:43
by tedy
I have a thread about Recent Documents functionality, and to some extent I'm happy (it adds opened documents in Windows' Recent Items submenu).
I can also add a User Button #1 and assign #156; as a script and it opens the Open... dialog where there is a dropdown with recently opened items.
The problem is there are also .exe files in the list and I want to filter these out. In a way I want a local and more customizable version of the recent items menu.
Could someone point some steps (as guidelines, even without scripts but i wouldnt mind some

) if this is possible - to fetch the last NN of the recently opened items, filter out the .exe entries, and show the list in a dropdown in a User Button in the toolbar, so I can open recent items with two clicks? For example the last 30 items, .exe's excluded.
Thanks.
Re: Fetch recently opened items and present in a toolbar men
Posted: 20 Nov 2013 12:13
by highend
Does XY store these entries in any of it's config files? If not you'll have a hard time to filter out all the superflous stuff inside
C:\Users\%UserName%\AppData\Roaming\Microsoft\Windows\Recent
...
Re: Fetch recently opened items and present in a toolbar men
Posted: 20 Nov 2013 12:26
by armsys
highend wrote:Does XY store these entries in any of it's config files? If not you'll have a hard time to filter out all the superflous stuff inside
C:\Users\%UserName%\AppData\Roaming\Microsoft\Windows\Recent
...
Following Highend's post above, you may try out the following command in the AddressBar:
Code: Select all
C:\Users\%UserName%\AppData\Roaming\Microsoft\Windows\Recent?!.exe
Re: Fetch recently opened items and present in a toolbar men
Posted: 20 Nov 2013 12:40
by tedy
highend, I'm sure it keeps them somewhere in XY's data structure. This is proven by the File - Open... command where you can see a long log of opened items in the dropdown list. Windows' log keep only the last 15 items, and not .EXE files.
Maybe there is a way to read these items with a script, from some folder in xyplorer\data, then remove .exe entries and present them in a dropdown in a User Button's dropdown somehow.
armsys, to repeat - I'm not interested in Windows' Recent Itmes anymore when we talk about a local version - the idea is the local version to be more customizable, the log is already there (as seen in Open... dialog), just is it possible with current scripting to achieve my goal? That's the question - if it is, then I'll invest some time to learn the language and the commands. I won't mind if you point out which commands could help in this.
Thanks.
Re: Fetch recently opened items and present in a toolbar men
Posted: 20 Nov 2013 12:42
by admin
Next beta will have something useful:
Code: Select all
+ SC get got a new named argument "list_recentlyopenedfiles".
Syntax: get("list_recentlyopenedfiles", [separator=CRLF])
[separator]: String to place between items.
Defaults to CRLF (line feed).
return: List of recently opened files (as used in menu
File | Open...).
Examples:
text get("list_recentlyopenedfiles");
goto inputselect("Goto to any of the Recently Opened Files", get("list_recentlyopenedfiles"), <crlf>, 5);
open inputselect("Open any of the Recently Opened Files", get("list_recentlyopenedfiles"), <crlf>, 5);
Re: Fetch recently opened items and present in a toolbar men
Posted: 20 Nov 2013 13:21
by highend
So you can use a simple command like:
Code: Select all
goto inputselect("Goto to any of the Recently Opened Files", formatlist(get("list_recentlyopenedfiles"), "ef", "<crlf>", "!*.exe"), "<crlf>", 5);
Which filters out all items that end on .exe.
If you still want to limit the list you'll have to use a foreach loop first.
E.g.:
Code: Select all
$limitEntries = 30;
$newItems = "";
$fileList = formatlist(get("list_recentlyopenedfiles"), "ef", "<crlf>", "!*.exe");
foreach($entry, $fileList, "<crlf>") {
if ($i++ <= $limitEntries) {
$newItems = $newItems . $entry . "<crlf>";
}
}
goto inputselect("Goto to any of the Recently Opened Files", $newItems, "<crlf>", 5);
Re: Fetch recently opened items and present in a toolbar men
Posted: 20 Nov 2013 13:24
by armsys
Highend, Thanks.

Re: Fetch recently opened items and present in a toolbar men
Posted: 20 Nov 2013 13:39
by tedy
highend, many thanks!

This will work in the future versions (beta etc.), right?
Re: Fetch recently opened items and present in a toolbar men
Posted: 20 Nov 2013 14:11
by highend
Sure, why not...
Re: Fetch recently opened items and present in a toolbar men
Posted: 20 Nov 2013 14:31
by tedy
No, I meant this will work and require at least the versions that come after the current one, but I guess so, because Don said he will add this SC functionality in the next beta.
I found how to increase the start menu recent items' list size (to 30) using the group policy editor, so it is not so urgent for now.
But using scripting we'll be able to construct different algos to show only images, or archives or etc. in the last items to show and being able to reopen more easily when filtered.
Re: Fetch recently opened items and present in a toolbar men
Posted: 20 Nov 2013 14:34
by RalphM
Just be aware that the Recents of Windows include files opened by other means than XY as well, whereas XY's list is longer but limited to files openend from XY!
Re: Fetch recently opened items and present in a toolbar men
Posted: 20 Nov 2013 14:42
by tedy
RalphM wrote:Just be aware that the Recents of Windows include files opened by other means than XY as well, whereas XY's list is longer but limited to files openend from XY!
Sure. This raises a question whether an Autohotkey script wouldn't be more appropriate. It could read the recent folder, filter if needed and display a GUI on the screen, using a hotkey.
I'm using AHK already for many years, to do some things in XY and other programs. For example Ctrl+MouseBack/Forward switches tabs more easily than Ctrl+(Shift+)Tab.
Re: Fetch recently opened items and present in a toolbar men
Posted: 20 Nov 2013 15:05
by highend
I don't see a reason to use AHK when XY can do it already...
E.g.:
Code: Select all
$limitEntries = 0;
$excludeExt = "|exe|library-ms|";
$fileList = "";
$recentEntries = listfolder("%appdata%\Microsoft\Windows\Recent", "*", 1, "|");
foreach($entry, $recentEntries, "|") {
if ($i == $limitEntries) {
break;
}
$realPath = property("#LinkTarget", $entry);
$realExt = getpathcomponent($realPath, "ext");
if ($excludeExt UnLikeI "*$realExt*") {
if (exists($realPath) == 1) {
$fileList = $fileList . $realPath . "<crlf>";
$i++;
}
}
}
goto inputselect("Goto to any of the Recently Opened Files", $fileList, "<crlf>", 5);
Re: Fetch recently opened items and present in a toolbar men
Posted: 20 Nov 2013 15:53
by tedy
Thanks, that is useful on its own.
But the idea was that with AHK you can invoke the recent items menu from anywhere, not only when you are working in XY and it has the focus.
Re: Fetch recently opened items and present in a toolbar men
Posted: 06 Dec 2013 16:24
by yusef88
highend wrote:So you can use a simple command like:
Code: Select all
goto inputselect("Goto to any of the Recently Opened Files", formatlist(get("list_recentlyopenedfiles"), "ef", "<crlf>", "!*.exe"), "<crlf>", 5);
Which filters out all items that end on .exe
how to add more filters !*.bat;!*.cmd;!*.com;!*.scr;!*.msi
-----------------
update: i added them like that "!*.exe", "!*.msi" and it works