solved [TC 11.03] Using the command line parameter /S=F sorts the listbox by name

Bug reports will be moved here when the described bug has been fixed

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
petermad
Power Member
Power Member
Posts: 15999
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

solved [TC 11.03] Using the command line parameter /S=F sorts the listbox by name

Post by *petermad »

The help for the command line says:
Help 4.a wrote:/S=F
Open "Find Files" dialog without TC main window, e.g. totalcmd.exe /S=F "c:\start path"
Accepts additional parameters separated by a colon, e.g. /S=F:S1Lname
S Sort results by: 1=name, 2=extension, 3=size, 4=date/time. Negative value for descending order
L<x> As LAST parameter: Load search with name <x>, e.g. "/S=F:Lmax 1 day old"
L=<x> As LAST parameter: Same as L<x>, but start search immediately
L==<x> As LAST parameter: Same as L=<x>, but feed results to listbox when search completes
It does not mention that if the additional parameter S is not used, then the sorting of the listbox defaults to sorting by Name.

Maybe it is by design, but since the currently chosen sort order is kept when using cm_SearchFor and cm_SearchStandalone I would expect the same when opening the Search dialog via the command line.


BTW, the help does not mention either, that if S is used with any number higher than 4, then unsorted sorting is used (which is a nice feature).
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.03] Using the command line parameter /S=F sorts the listbox by name

Post by *ghisler(Author) »

Yes, it's by design - TC itself uses /S=F when starting search in a separate thread, and it passes the sort parameter to search for this purpose. If no sort parameter is passed, the default sort order as when TC is stated for the first time is used.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 15999
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 11.03] Using the command line parameter /S=F sorts the listbox by name

Post by *petermad »

TC itself uses /S=F when starting search in a separate thread
By "TC itself" do you mean when using the cm_SearchStandalone?

When I use cm_SearchStandalone the current sort order is maintained, even if it is for a custom column.

If no sort parameter is passed, the default sort order as when TC is stated for the first time is used.
That seems fair enough if no TC instances are running when TC is started with the /S=F parameter. But would it be possible to make it optional to use the current sort order if there already is a TC running (as when using cm_SearchStandalone)?
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.03] Using the command line parameter /S=F sorts the listbox by name

Post by *ghisler(Author) »

By "TC itself" do you mean when using the cm_SearchStandalone?
Yes exactly. /S=F is just the documented interface.
But would it be possible to make it optional to use the current sort order if there already is a TC running
It's not that simple. TC would either have to add a sort parameter by itself when the user uses /S=F, or the called search dialog would have to communicate somehow with one of the running TC instances to find out the sort order of the current tab on the active side. But the standalone search is independent from the calling program, it could have been called from a completely different program.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 15999
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 11.03] Using the command line parameter /S=F sorts the listbox by name

Post by *petermad »

But the standalone search is independent from the calling program, it could have been called from a completely different program.
Sure, but if there i one or more running instances of TC, "Feed to listbox" is fed to the running TC instance that is in front - why not assume that the sort order should be left unchanged, unless the S parameter is used.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.03] Using the command line parameter /S=F sorts the listbox by name

Post by *ghisler(Author) »

There is currently no function to get the sort order of the active panel from TC.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 15999
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 11.03] Using the command line parameter /S=F sorts the listbox by name

Post by *petermad »

But do you need to know the active sort order to leave it as it is? just as when using cm_Exit 1
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.03] Using the command line parameter /S=F sorts the listbox by name

Post by *ghisler(Author) »

What do you mean? The standalone search does not know the sort order of the program which opened it unless you passed the S parameter to it. So I don't understand what you mean with "leave it as it is".
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 15999
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 11.03] Using the command line parameter /S=F sorts the listbox by name

Post by *petermad »

Scenario:
I have a TC running with for example Unsorted as the sort order in both panels
I use the command %COMMANDER_EXE% /S=F from for example a button or the command line in TC.
In the Find Files (separate) dialog that is opened, I perform a search and click the "Feed to listbox" button.
The Search result is fed to the already running TC and the sort order is now changed to Name - why could it not be just left as it was: Unsorted
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.03] Using the command line parameter /S=F sorts the listbox by name

Post by *ghisler(Author) »

The reason is that the sort order used in the search dialog is preserved when clicking on "Feed to listbox". For example, if you opened the dialog via menu "Search in background" while TC was showing an unsorted folder, the results would be shown unsorted in the search results. When the user then clicks on "Feed to listbox", that sort order is kept even if the user changed the sort order in Total Commander in the meantime.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 15999
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 11.03] Using the command line parameter /S=F sorts the listbox by name

Post by *petermad »

that sort order is kept even if the user changed the sort order in Total Commander in the meantime.
Aha, yes I see that when I use "Search in separate Process..." (cm_SearchStandalone) where I can change the TC's sorter while Find Files is open.

Maybe we could have an option like TransferSearchOrder= 1/0 for wincmd.ini - or a new value for the additional :S parameter: 5=name, but don't transfer order to listbox.
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.03] Using the command line parameter /S=F sorts the listbox by name

Post by *ghisler(Author) »

Or a new parameter like /S=FS* where TC would replace the * by the current sort order when launching the command from a button. But then TC would have to parse each command and look for this sequence.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 15999
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 11.03] Using the command line parameter /S=F sorts the listbox by name

Post by *petermad »

Or a new parameter like /S=FS*
Whatever that works...
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 50390
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: [TC 11.03] Using the command line parameter /S=F sorts the listbox by name

Post by *ghisler(Author) »

This should be working in Total Commander 11.50 beta 1, please check it!
18.07.24 Added: Standalone search started via /S=F: Extra parameter S* tells search to get the sort order from a currently running Total Commander, e.g. totalcmd64.exe /S=F:S* (32/64)
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 15999
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: [TC 11.03] Using the command line parameter /S=F sorts the listbox by name

Post by *petermad »

Confirmed fixed as described in TC 11.50b1 :-)

Moderator message from: petermad » 2024-10-09, 19:27 UTC

Moved to "TC fixed bugs" from "TC11.x bug reports (English)"
License #524 (1994)
Danish Total Commander Translator
TC 11.51 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1391a
TC 3.60b4 on Android 6, 13, 14
TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
Post Reply