Page 1 of 1
To sort files in the order they were opened [Solved]
Posted: 25 Mar 2022 20:38
by John_C
Is it possible to sort files in the order you have opened them?
This is useful, for example, when you view a tab that lists
all of the files you have recently opened:
Code: Select all
<get list_recentlyopenedfiles> ? /silent=1
The column "Accessed" cannot be used for this.
Re: To sort files in the order they were opened
Posted: 25 Mar 2022 20:43
by jupe
Short answer is no, as you know the best you can do currently is have them displayed in the order they are in in the recently opened list.
You could possibly write a script that all files are associated with via CFA so that every time you run one it adds a date and filename to a log before opening the file, and then process that file when you open your recent list, but it would be quite a bit of scripting.
Re: To sort files in the order they were opened
Posted: 25 Mar 2022 20:54
by John_C
I see, thanks.
Re: To sort files in the order they were opened [Answered]
Posted: 25 Mar 2022 20:57
by highend
Are "list_recentlyopenedfiles" files in any other way populated than through "File - Open"?
Double clicking them inside XY doesn't seem to add them to that list...
Re: To sort files in the order they were opened [Answered]
Posted: 25 Mar 2022 21:09
by John_C
This looks interesting.
When I open a file by double clicking or by pressing Enter, XY do add the file to that list...
xy 20.30, win7
the same for xy 20.90.0100
Re: To sort files in the order they were opened [Answered]
Posted: 25 Mar 2022 21:11
by jupe
@highend: no they get added when your CFA is eg ext>exe or via SC open etc or plain OS assoc too in most cases, but not other SC CFAs like run.
@John_C: I just had a thought, maybe you are asking this question because you have saved your QS results screen to sort by name by default or something, in that case then you will get that sort, but if you are happy with the order that is in List Management, which mainly gets updated when a file is re-launched anyway, then if you change your sort to "Unsorted" it shows them in that order, I think I misunderstood your question.
View | Sort By | Unsorted
Re: To sort files in the order they were opened [Answered]
Posted: 25 Mar 2022 21:15
by John_C
Hmm, no View | Sort By| Unsorted doesn't change the order the files are sorted.
Neither refreshing the tab changes anything.
Re: To sort files in the order they were opened [Answered]
Posted: 25 Mar 2022 21:19
by jupe
It wouldn't change the order unless you had already sorted by a different column first (maybe by your defaults), which I thought you might have done otherwise why would you be asking because they already display in the recent list order then.
Re: To sort files in the order they were opened [Answered]
Posted: 25 Mar 2022 21:37
by John_C
Well, yes, this is something obvious, but what I need is to sort the files as they were opened.
I have created six files:
Code: Select all
a1.txt
a2.txt
b1.exe
b2.exe
c1.txt
c2.txt
They are sorted by name here.
If I resort them by extension, it will be
Code: Select all
b1.exe
b2.exe
a1.txt
a2.txt
c1.txt
c2.txt
If I change the order to Unsorted, the order will stay the same.
If I open c1.txt with Sublime Text and then close it, the order will stay the same.
If I change the sorting back to "by name", the order will be as in the first example.
But since I have opened c1.txt, I expect to have
Code: Select all
c1.txt
a1.txt
a2.txt
b1.exe
b2.exe
c2.txt
or
Code: Select all
c1.txt
b1.exe
b2.exe
a1.txt
a2.txt
c2.txt
at some point.
Re: To sort files in the order they were opened [Answered]
Posted: 25 Mar 2022 22:22
by highend
Mh, it must work differently here...
A fresh 22.30 instance shows 155 folders and 916 files when
<get list_recentlyopenedfiles> ? /silent=1
is executed from the address bar
I've never opened 99% of them at all (neither in the fresh instance^^ nor in my normal configured one)
What am I missing here?
Re: To sort files in the order they were opened [Answered]
Posted: 25 Mar 2022 22:23
by jupe
If you run this script sortbylist <get list_recentlyopenedfiles>; with the recent list tab visible, I think it is what you are trying to explain you want.
@highend: If the list is empty (eg. fresh, check list management) you will get a recursive search of the folder that is open, since the var will be ""
Re: To sort files in the order they were opened [Answered]
Posted: 25 Mar 2022 22:26
by highend
If the list is empty (eg. fresh, check list management) you will get a recursive search of the folder that is open.
Ah
Not really what I would have expected

Re: To sort files in the order they were opened [Answered]
Posted: 25 Mar 2022 22:31
by highend
Yeah, I see, the result will be "correct" when used via text get("list_recentlyopenedfiles");
Either empty or the opened files...
Re: To sort files in the order they were opened [Answered]
Posted: 25 Mar 2022 22:35
by John_C
If you run this script sortbylist <get list_recentlyopenedfiles>; with the recent list tab visible, I think it is what you are trying to explain you want.
Yes, it seems this is exactly what I asked for, thanks!
Re: To sort files in the order they were opened [Solved]
Posted: 25 Mar 2022 22:38
by jupe
@John_C:
@highend: When the var is empty it's the same behavior as entering this in the AB
? /silent=1.