Button to select first folder starting with a certain letter?
Moderators: Hacker, petermad, Stefan2, white
Button to select first folder starting with a certain letter?
Hi folks,
Please take a look at the image below.
Image: https://ibb.co/ZS2ptsk
I have created a second button bar of the alphabet (i made these ICOs, if you want them, grab them here:
https://drive.google.com/file/d/1Tzk_h257HFmlTIj2FdQgPqkSk8smuECB/view?usp=sharing)
When i click on, for example, button P, i want to select the first folder on the drive (or inside another folder) that starts with the letter P.
But i don't want to go inside the folder, i just want it selected and visible in the viewer.
Is that somehow possible?
Thanks!
Please take a look at the image below.
Image: https://ibb.co/ZS2ptsk
I have created a second button bar of the alphabet (i made these ICOs, if you want them, grab them here:
https://drive.google.com/file/d/1Tzk_h257HFmlTIj2FdQgPqkSk8smuECB/view?usp=sharing)
When i click on, for example, button P, i want to select the first folder on the drive (or inside another folder) that starts with the letter P.
But i don't want to go inside the folder, i just want it selected and visible in the viewer.
Is that somehow possible?
Thanks!
Re: Button to select first folder starting with a certain letter?
Code: Select all
selectfilesD <^p
To select exclusively the first one of such folders, and, moreover, to do it in a recursive mode, seemes to be a pretty challenging task.
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10/15
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10/15
Re: Button to select first folder starting with a certain letter?
Thanks!
Could a workaround would be if i just created one dummy folder for each alphabet letter, so in my example: :\P\
Then pressing the "P" button would select (and show in the window) that folder selected without going inside it.
Might that be do-able?
Could a workaround would be if i just created one dummy folder for each alphabet letter, so in my example: :\P\
Then pressing the "P" button would select (and show in the window) that folder selected without going inside it.
Might that be do-able?
Re: Button to select first folder starting with a certain letter?
Configuration > Quick Search > ◉ Letter only + ☑ Beginning (name must start with first typed character)
cm_GoToFirstEntry,cm_QuickSearch
cm_GoToFirstEntry,cm_QuickSearch
Overquoting is evil! 👎
Re: Button to select first folder starting with a certain letter?
That works, but requires two extra steps (type letter, enter).
Or maybe i misunderstand?
Or maybe i misunderstand?
Re: Button to select first folder starting with a certain letter?
Ok, so i got it working with a dummy folder.
Folder name: P00
Command: selectfilesD <^P00
That's good enough for me, but if anyone knows how to do it without the dummy folders, I'd be happy to hear it!
EDIT: one detail, with the above workaround, the P00 folder is selected and in view, but at the bottom of the window.
But because the whole point of this is to be able to quickly browse all P folders, it would make more sense if it was highlighted and placed near the top of the window.
Do we have any control over where the selected item is, window-wise?
Folder name: P00
Command: selectfilesD <^P00
That's good enough for me, but if anyone knows how to do it without the dummy folders, I'd be happy to hear it!
EDIT: one detail, with the above workaround, the P00 folder is selected and in view, but at the bottom of the window.
But because the whole point of this is to be able to quickly browse all P folders, it would make more sense if it was highlighted and placed near the top of the window.
Do we have any control over where the selected item is, window-wise?
Last edited by Dazzer on 2023-12-12, 00:22 UTC, edited 2 times in total.
Re: Button to select first folder starting with a certain letter?
The setting doesn't require this. Press Home, then enter the letter.
I've given the chain of command as an alternative.
Overquoting is evil! 👎
Re: Button to select first folder starting with a certain letter?
OK! but still one extra action, compared to just pressing the P button i created!
Re: Button to select first folder starting with a certain letter?
Sorry, maybe i misunderstand, but you said press "Press Home, then enter the letter".
That's two actions.
Pressing the P button in my above workaround is one action.
That's two actions.
Pressing the P button in my above workaround is one action.
Re: Button to select first folder starting with a certain letter?
You just marking files that start with the specified letters. But you don't select the first file as you requested at the beginning.
A quick search takes you to the first file, but only from the beginning of the list, so you need to press Home.
Of course, you can select a file using the hotkey assigned to em_p:
But I definitely wouldn't replace the letter keys themselves with such a command. But that's probably what you need.
A quick search takes you to the first file, but only from the beginning of the list, so you need to press Home.
Of course, you can select a file using the hotkey assigned to em_p:
%COMMANDER_PATH%\Addons\TCFS2\TCFS2.exe /ef sendmsg(msg(1074,3),$0B,0) tcm(2049) tcm(2056) send(@p) tcm(2918) sendmsg(msg(1074,3),$0B,1) |
But I definitely wouldn't replace the letter keys themselves with such a command. But that's probably what you need.
Last edited by Fla$her on 2023-12-12, 08:17 UTC, edited 1 time in total.
Overquoting is evil! 👎
Re: Button to select first folder starting with a certain letter?
Are you talking about selecting the folder in the Separate Tree or in the File Panel? And what do you mean by "the viewer"?But i don't want to go inside the folder, i just want it selected and visible in the viewer.
Anyway, in both the Tree and the File Panel you can use Quick Search to go to an item that starts with a certain letter .- just press Ctrl+Alt+Letter to jump to the folder that starts with that letter. You configure which keys to use for the Quick Search in "Configuration" -> "Options..." -> "Quick Search"
In the file panel in anything but Tree View it is NOT possible to select a subfolder to the shown folders - you can only select visible elements.
The buttons can NOT work for the Separate Tree, but you could make for example the A-button and B-button for selecting folders in the file Panel like this:
In your usercmd.ini (located in the same folder as your wincmd.ini file) you can add this:
Code: Select all
[em_unmarkNextSelected]
cmd=cm_SrcByName 8,cm_SrcByName 1,cm_GoToNextSelected,cm_GoToNext,cm_Unselect 50,cm_GoToPrevSelected,cm_SrcByName 9
[em_selectA]
cmd=SELECTFILESD a*
[em_selectB]
cmd=SELECTFILESD b*
Put this in the Command Field of your A button:
Code: Select all
em_selectA,em_unmarkNextSelected
Put this in the Command Field of your B button:
Code: Select all
em_selectB,em_unmarkNextSelected
You would have to make an em_command in your usercmd.ini file for each letter.
You will have to be sure to be at the first entry [..] in the File Panel before you start the first selection, and you would have to click the buttons in alphabetical order if you want to select more than one folder.
It will not work reliably if the Tree is shown in the folder panel.
It will not work if there are more than 50 folders starting with the same letter.
This is not a perfect solution, but the best I can think of without having to use external utilities like AutoHotkey or TCFS2.
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
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
Re: Button to select first folder starting with a certain letter?
This is 9/10 of a TotalCommander button.
The only downside it would launch Explorer. Lol.
Otherwise, it does exactly what is requested.
It will find and highlight the first p-folder no matter how deep it's being dug.
The only downside it would launch Explorer. Lol.
Otherwise, it does exactly what is requested.
Code: Select all
Invoke-Expression "explorer '/select,$((Get-ChildItem $pwd -Directory -recurse | Where-Object -Property Name -match '^p' | Select-Object -First 1).FullName)'"
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10/15
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10/15
Re: Button to select first folder starting with a certain letter?
2petermad
Placing the cursor on a folder is a folder selection. So here instead of em_unmarkNextSelected it's more correct like this:
And perform with the preliminary removal of the selection: cm_ClearAllFolders,em_selectA,em_GoToFirstSelectedFolder
Placing the cursor on a folder is a folder selection. So here instead of em_unmarkNextSelected it's more correct like this:
Code: Select all
[em_GoToFirstSelectedFolder]
cmd=cm_GoToFirstEntry,cm_GoToPrev,cm_GoToNextSelected,cm_GoToPrevSelected,cm_ClearAllFolders
Overquoting is evil! 👎
Re: Button to select first folder starting with a certain letter?
These versions now work with the Total Commander itself.
This one will search for the P-folder recursively, find the first P-folder wherever it is, and enter it:
This one will search for the P-folder recursively, find the first P-folder wherever it is, and set the cursor on it, highlighting it:
This one will search for the P-folder recursively, find the first P-folder wherever it is, and enter it:
Code: Select all
Invoke-Expression "$env:commander_exe /O $((Get-ChildItem $pwd -Directory -recurse | Where-Object -Property Name -match '^p' | Select-Object -First 1).FullName)"
Code: Select all
Invoke-Expression "$env:commander_exe /O /P /S $((Get-ChildItem $pwd -Directory -recurse | Where-Object -Property Name -match '^p' | Select-Object -First 1).FullName)"
#278521 User License
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10/15
Total Commander [always the latest version, including betas] x86/x64 on Win10 x64/Android 10/15