A command to get the list of recently opened files to open them [Solved]

Please check the FAQ (https://www.xyplorer.com/faq.php) before posting a question...
John_C
Posts: 336
Joined: 16 May 2018 20:04

Re: A command to get the list of recently opened files to open them [Solved]

Post by John_C »

@klownboy Thanks, this is useful. And now I have a working example about how to add icons :-)

John_C
Posts: 336
Joined: 16 May 2018 20:04

Re: A command to get the list of recently opened files to open them [Solved]

Post by John_C »

klownboy wrote: 16 Mar 2022 00:45

Code: Select all

"Recent Locations|:find||1" goto "<get list_recentlocations>? /ln /silent=1";
Do you know whether is it possilbe to make this tab to have a correct name (i.e., "Search Results") _before_ the tab has been created?

The code below is for testing purposes. It works, but renaming takes effect _after_ the tab has been created. I wonder if there is a better approach:

Code: Select all

"Recent"
  tab("new");
  goto "<get list_recentlocations>? /ln /silent=1";
  sortbylist <get list_recentlyopenedfiles>;
  tab("rename", "Search Results");
  tab("lock");

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

Re: A command to get the list of recently opened files to open them [Solved]

Post by highend »

Create a new background tab and switch to it once all steps are done? You can't create a tab and give it a name in one step
One of my scripts helped you out? Please donate via Paypal

VeeGee

Re: A command to get the list of recently opened files to open them [Solved]

Post by VeeGee »

Not sure if this is correct, but I tried just this line :

Code: Select all

tab("new","I Like Pizza");
and it created a new tab with the name I specified in a single step. I didn't see that as an option in the Help file, but tried it anyway.

John_C
Posts: 336
Joined: 16 May 2018 20:04

Re: A command to get the list of recently opened files to open them [Solved]

Post by John_C »

highend wrote: 06 Apr 2022 23:39 Create a new background tab and switch to it once all steps are done? You can't create a tab and give it a name in one step
Thanks, but how can I switch to the background tab after all preparations are done? This seems to be obvious, but I don't see answer in the Help.

Is there something like "swich to a tab by its index"?

Code: Select all

"test"
  tab("newb");
  $newbindex = tab("get", "index") + 1;
  tab("rename", "Search Results", $newbindex);
  // <-- I need to switch to the background tab before using goto -->
  goto "<get list_recentlyopenedfiles> ? /silent=1";

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

Re: A command to get the list of recently opened files to open them [Solved]

Post by highend »

seltab?
One of my scripts helped you out? Please donate via Paypal

John_C
Posts: 336
Joined: 16 May 2018 20:04

Re: A command to get the list of recently opened files to open them [Solved]

Post by John_C »

Duh, thanks! One another question if you have a minute.

What's wrong in the second line in the second block?

Code: Select all

// to open a tab with recently opened files. the files are sorted in the
// order they were opened (the last opened file will be the topmost)
"recent files"
  goto "<get list_recentlyopenedfiles> ? /silent=1";
  sortbylist <get list_recentlyopenedfiles>;

// the same for folders
"recent folders"
  goto "%SystemDrive% <get list_recentlocations> ? /silent=1 /ln";
  sortbylist <get list_recentlocations> /n; // why doesn't it work?

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

Re: A command to get the list of recently opened files to open them [Solved]

Post by highend »

Does that look like a valid path / quick search pattern? Nope^^
One of my scripts helped you out? Please donate via Paypal

John_C
Posts: 336
Joined: 16 May 2018 20:04

Re: A command to get the list of recently opened files to open them [Solved]

Post by John_C »

Well, but sortbylist <get list_recentlyopenedfiles> works, isn't it?

This is why I expected that sortbylist <get list_recentlocations> or sortbylist <get list_recentlocations> /n (maybe with ? before /n) will do the same trick for folders. But it doesn't.

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

Re: A command to get the list of recently opened files to open them [Solved]

Post by highend »

I don't know what works on your system or not. Didn't see any examples, screenshots or gifs

sortbylist doesn't work with quick search patterns and apart from that, it won't filter by folders with trailing backslashes...
One of my scripts helped you out? Please donate via Paypal

John_C
Posts: 336
Joined: 16 May 2018 20:04

Re: A command to get the list of recently opened files to open them [Solved]

Post by John_C »

It was another thread where I aksed how I can sort files in the order I have opened them.

Here it is, just in case: viewtopic.php?f=3&t=24447

jupe wrote:
If you run this script sortbylist <get list_recentlyopenedfiles>; [...] I think it is what you are trying to explain you want.
He was correct, this line works for me. Here is an example. Create the following 6 files:

Code: Select all

a1.txt
a2.txt
b1.exe
b2.exe
c1.txt
c2.txt
Then open c1 with Sublime Text. You don't need to modify it. Just close it. Execute sortbylist <get list_recentlyopenedfiles>; from the address bar. The order of files will be changed to

Code: Select all

c1.txt
a1.txt
a2.txt
b1.exe
b2.exe
c2.txt
******

I try to achieve the similar effect to sort folders. If I have visited some (or maybe created/changed some file inside it), the position of this folder should be changed to the topmost. For example, you have 3 folder:

Code: Select all

Folder0
  |-- Folder1
  |-- Folder2
  |-- Folder3
Then you open Folder2. Or maybe you open Folder2 and modify some file inside it. Then you return to the Folder0 and execute sortbylist <get list_recentlocations> or something similar from the address bar. The order of folders should be changed to

Code: Select all

Folder0
  |-- Folder2
  |-- Folder1
  |-- Folder3

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

Re: A command to get the list of recently opened files to open them [Solved]

Post by highend »

Real world examples^^

Code: Select all

<get list_recentlocations>
What does it contain and you did read that it won't filter by folders with trailing backslashes?^^
One of my scripts helped you out? Please donate via Paypal

Post Reply