New SELECTFILES modifier

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
funkymonk
Senior Member
Senior Member
Posts: 491
Joined: 2013-12-04, 09:56 UTC

New SELECTFILES modifier

Post 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.
User avatar
white
Power Member
Power Member
Posts: 5743
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: New SELECTFILES modifier

Post 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.
Fla$her
Power Member
Power Member
Posts: 2981
Joined: 2020-01-18, 04:03 UTC

Re: New SELECTFILES modifier

Post 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.
Overquoting is evil! 👎
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: New SELECTFILES modifier

Post 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






 
User avatar
funkymonk
Senior Member
Senior Member
Posts: 491
Joined: 2013-12-04, 09:56 UTC

Re: New SELECTFILES modifier

Post 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:
  1. 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).
  2. 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.
  3. "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.
  4. 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.
Fla$her
Power Member
Power Member
Posts: 2981
Joined: 2020-01-18, 04:03 UTC

Re: New SELECTFILES modifier

Post 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.
Overquoting is evil! 👎
User avatar
petermad
Power Member
Power Member
Posts: 15997
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: New SELECTFILES modifier

Post 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.
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
funkymonk
Senior Member
Senior Member
Posts: 491
Joined: 2013-12-04, 09:56 UTC

Re: New SELECTFILES modifier

Post 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.
User avatar
funkymonk
Senior Member
Senior Member
Posts: 491
Joined: 2013-12-04, 09:56 UTC

Re: New SELECTFILES modifier

Post 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.
Post Reply