Page 1 of 1
New SELECTFILES modifier
Posted: 2024-08-10, 08:15 UTC
by funkymonk
Hello,
According to the help, SELECTFILES already supports some modifiers:
SELECTFILES file types marks files of the given type, e.g. SELECTFILES *.txt *.doc
Supported modifiers: D=only folders, B=both, U=unselect, L=left side, R=right side, T=target panel, S=When Shift is pressed during execution, marks also folders. Add directly to the end of the command name, like selectfilesD or selectfilesDUT or any meaningful combination.
I would appreciate a new modifier to
toggle the selection. Maybe R for reverse (since T is already in use)?
Background: I use a shortcut for SELECTFILESBT to select a file/dir in the target panel that has the same name than the one under the cursor.
It would be great if I could not only select but also toggle the selection.
Re: New SELECTFILES modifier
Posted: 2024-08-10, 08:37 UTC
by white
funkymonk wrote: 2024-08-10, 08:15 UTC
Maybe R for reverse (since T is already in use)?
R is also already in use.
Re: New SELECTFILES modifier
Posted: 2024-08-10, 10:01 UTC
by Fla$her
funkymonk wrote: 2024-08-10, 08:15 UTC
but also toggle the selection.
To what? Previous selection, deselect or what?
The main problem is that there is no marker by which it would be possible to distinguish one selection from another, since it is not static and can be changed at any time.
Re: New SELECTFILES modifier
Posted: 2024-08-10, 10:52 UTC
by Stefan2
funkymonk wrote: 2024-08-10, 08:15 UTC
Background: I use a shortcut for SELECTFILESBT to select a file/dir in the target panel
that has the same name than the one under the cursor.
It would be great if I could not only select but also toggle the selection.
See text file TOTALCMD.INC in TC-folder,
and there
cm_FocusTrg=4006;Focus on target file list
and maybe
CM_WAIT <time>=-12;Wait x milliseconds
and
cm_ExchangeSelection=525;Invert selection
So you can try a combo command like: SELECTFILESBT,cm_FocusTrg,cm_ExchangeSelection
Re: New SELECTFILES modifier
Posted: 2024-08-10, 11:23 UTC
by funkymonk
white wrote: 2024-08-10, 08:37 UTC
funkymonk wrote: 2024-08-10, 08:15 UTC
Maybe R for reverse (since T is already in use)?
R is also already in use.
Sorry, of course. I had overlooked that.
Maybe my explanation was not clear. Thus:
- Assume there is a file named "test.txt" in each file panel
(it could be the same file if left and right show the same dir, or two different files with the same name if left and right show different dirs).
- The cursor is at "test.txt" in either of the two panels. It is not relevant whether the file is currently selected in this panel or not.
- "SELECTFILESBT %N" will select the file test.txt in the other panel. If it is already selected it will stay selected.
"SELECTFILESBTU %N" will unselect the file test.txt in the other panel. If it is already unselected it will stay unselected.
- What I miss is a SELECTFILES modifier that toggles the selection of test.txt in the other panel: selected turns to unselected and vice versa.
Re: New SELECTFILES modifier
Posted: 2024-08-10, 15:53 UTC
by Fla$her
2funkymonk
The work of SELECTFILES is not limited to a single name. It can be a mask, a template, and a regular expression, so your query looks quite specific and unlikely to be implemented, since it requires reverse analysis during inversion. It's better to use a script for one element, but you need to know what should happen if you select several elements in the active or target panel with forward and reverse execution.
By the way, you can already register the number of such a command in TC using RegisterCommand in Autorun. If you need help, I'll explain how.
Re: New SELECTFILES modifier
Posted: 2024-08-12, 19:52 UTC
by petermad
Here is a workaround. Put these in your usercmd.ini file
Code: Select all
[em_GoToFirstEntry]
cmd=cm_GoToFirstEntry,cm_GotoPrev
[em_SaveSelectionTarget]
cmd=cm_FocusTrg,em_GoToFirstEntry,cm_SaveSelection,cm_ClearAll
[em_SelectItem]
cmd=SELECTFILESB
param="%M"
[em_reverse_item_opositepanel]
cmd=em_SaveSelectionTarget,em_SelectItem,cm_GotoNextSelected,cm_UnSelect -1,cm_RestoreSelection,cm_Reverse -1,cm_FocusTrg
menu=Reverse selection of file/folder with same name in opposite panel if it exists
And make a button with the em_reverse_item_opositepanel command. Other selections in the target will be preserved.
Re: New SELECTFILES modifier
Posted: 2024-08-12, 21:51 UTC
by funkymonk
Hi petermad,
Thank you very much for your support and time!
Meanwhile I have implemented a very similar workaround:
Code: Select all
[em_ToggleSelectionOfSameFilenameInTargetPanel]
cmd=em_GotoSameFileInOtherPanel,cm_reverse -1,cm_FocusTrg
menu=Reverse selection of file/folder with same name in target panel
In the end, "my" solution boils down to your solution since it is based on a command which I took from your extended menus (probably with some modifications) a long time ago:
Code: Select all
[em_GotoSameFileInOtherPanel]
cmd=em_SaveSelectionOfTargetPanel,em_SelectItemWithSameNameInOtherPanel,cm_FocusTrg,cm_GotoNextSelected,em_UnselectCurrentItem,cm_RestoreSelection
menu=Go to file/folder with same name in opposite panel
[em_SaveSelectionOfTargetPanel]
cmd=cm_FocusTrg,em_GoToFirstEntry,cm_SaveSelection,cm_ClearAll,cm_FocusTrg
[em_SelectItemWithSameNameInOtherPanel]
cmd=SELECTFILESBT
param="%N"
[em_UnselectCurrentItem]
cmd=SELECTFILESBU
param="%N"
Thank you once more for the extended menus (I don't use them, but I find the implementation quite inspiring).
Your solution is more optimized since it achieves the same goal with less commands and panel switching. However, my usercmd.ini is already quite large and I wanted to use commands that I already have.
Still, a problem with both our solutions is the (imho annoying) message box that pops up if the file does not exist in the target panel. Maybe I (or someone else) will find a solution to that.
@ghisler: I want to renew my initial suggestion to implement the new modifier for SELECTFILES. I guess this would be helpful in other situations as well.
So far I'm still very happy with the workaround. (Maybe I will optimize a bit more but there is no time at the moment.)
BTW: I have assigned the shortcut S+SPACE to the new command. This allows me select "sets of files" in the other panel without changing the selection in the current panel.
Re: New SELECTFILES modifier
Posted: 2024-08-12, 22:05 UTC
by funkymonk
Hi Fla$her,
thank you as well. I think the implementation isn't that hard, even regarding the support for regex etc. In the end, I don't want to speculate on code that I haven't implemented and @ghisler needs to know.
Regarding autorun: Sure, that can be done. I use various tools like autorun for extending/optimizing/changing/whatever other applications according to my needs. That's ok and annoying at the same time. For most applications I simply accept that and don't even think about sending a suggestion. But as a ~30y user, TC is indeed different to me. There is not many tools that survive for such a long time and I really love to see TC grow further by having some functionality implemented directly.