Page 3 of 3

Re: Selecting files with same name or name+ext

Posted: 2025-03-21, 05:12 UTC
by sa16
I just forgot it.
Thank you for remembering! :)

Re: Selecting files with same name or name+ext

Posted: 2025-03-25, 12:58 UTC
by sa16
Fla$her wrote: 2025-03-19, 21:50 UTC This is not suitable for names with multiple dots. It should be done by analogy with the following example for the current item:
A dot in regular expressions is a meta-character and is used to search for an arbitrary character,
as a result, an error occurs, the command for the cursor on name1.1.txt mark name1_1.txt, name1x1.txt, etc.
There are also problems with other (^() [] {} $ + ) meta-characters in names...

Re: Selecting files with same name or name+ext

Posted: 2025-03-25, 13:41 UTC
by petermad
sa16 wrote: 2025-03-25, 12:58 UTC A dot in regular expressions is a meta-character and is used to search for an arbitrary character,
that is why the dot is escaped with a \ in Fla$her's regexp: <^%O\.?[^.]*$

Re: Selecting files with same name or name+ext

Posted: 2025-03-25, 13:53 UTC
by Fla$her
sa16 wrote: 2025-03-25, 12:58 UTCas a result, an error occurs
Yes, it's necessary to escape metacharacters inside %O, which I usually do in scripts at the expense of another regexp. You can't do this in a regular button.
It's possible to use a chain of two em_ commands. The first one will have "sed ...|clip", and the second one will have my button analog, but instead of %O it will be %|CLIPNAME1|. But given my code for Autorun, I guess this idea doesn't make much sense anymore.

Re: Selecting files with same name or name+ext

Posted: 2025-03-25, 14:13 UTC
by sa16
2petermad
This is the dot before the extension, and other dots may be in the most base name (%O): "name1.1".

Re: Selecting files with same name or name+ext

Posted: 2025-03-25, 16:04 UTC
by petermad
and other dots may be in the most base name (%O):
You are right name1.name2.ext will erroneously match for example name1,name2.ext

Re: Selecting files with same name or name+ext

Posted: 2025-03-27, 07:12 UTC
by sa16
petermad wrote: 2025-03-20, 13:21 UTC 2sa16
The more characters you allow in the extension, the bigger risk of false markings.
This option, in my opinion, is better:

Code: Select all

TOTALCMD#BAR#DATA
SELECTFILESS
"%S:~-0,255.*." "%S:~-0,255"
wcmicons.dll,39
Select all items with same base name as selected items|Hold Shift to also select folders
But the problem with DEFAULT.BAR.bak --> DEFAULT.BAR remains.

Re: Selecting files with same name or name+ext

Posted: 2025-03-27, 20:14 UTC
by petermad
2sa16

Much better :-)

Re: Selecting files with same name or name+ext

Posted: 2025-03-30, 15:08 UTC
by sniper0
petermad wrote: 2025-03-20, 03:16 UTC 2sniper0
Hmm, If i mark/select for example the first 5 files in any of the panels, and then use the second button here above - then the corresponding files are selected in the opposite panel.

You have to mark the files to indicate which ones you want a match for - if you only click the button, only the file under the cursor will be matched.
Marked the first 5 file and the buttons dont work, no matches found. Changed to other panel but no luck.

Re: Selecting files with same name or name+ext

Posted: 2025-03-30, 15:39 UTC
by sa16
2sniper0
What version of the program do you have? Need TC 10.00 and fresher.

Re: Selecting files with same name or name+ext

Posted: 2025-03-30, 20:47 UTC
by sniper0
sa16 wrote: 2025-03-30, 15:39 UTC 2sniper0
What version of the program do you have? Need TC 10.00 and fresher.
9.0a :/

Re: Selecting files with same name or name+ext

Posted: 2025-04-10, 05:45 UTC
by sa16
sa16 wrote: 2025-03-27, 07:12 UTC But the problem with DEFAULT.BAR.bak --> DEFAULT.BAR remains.
As if the problem is solved by a chain of em_commands:

Code: Select all

[em_SelS_1]
cmd=SELECTFILESS
param=""%S:~-0,255.*.""
[em_SelS_2]
cmd=SELECTFILESS
param=""%S:~-0,255" | "*.*.*""
or, likewise, with the TCFS2 button:

Code: Select all

TOTALCMD#BAR#DATA
%COMMANDER_PATH%\Utils\TCFS2\TCFS2.exe /ef
"set_ini(`%%COMMANDER_PATH%%\usercmd.ini`,em_TempParam,cmd,`SELECTFILESS`) set_ini(`%%COMMANDER_PATH%%\usercmd.ini`,em_TempParam,param,`""%%S:~-0,255.*.""`) tem(`em_TempParam`) delay(100) if(findwnd(`#32770`), send(`{ENTER}`, findwnd(`#32770`))) set_ini(`%%COMMANDER_PATH%%\usercmd.ini`,em_TempParam,cmd,`SELECTFILESS`) set_ini(`%%COMMANDER_PATH%%\usercmd.ini`,em_TempParam,param,`""%%S:~-0,255" | "*.*.*""`) tem(`em_TempParam`) delay(100) if(findwnd(`#32770`), send(`{ENTER}`, findwnd(`#32770`)))"
wcmicons.dll,39
Select all items with same base name as selected items|Hold Shift to also select folders

Re: Selecting files with same name or name+ext

Posted: 2025-04-10, 15:40 UTC
by petermad
sa16 wrote: 2025-04-10, 05:45 UTC As if the problem is solved by a chain of em_commands:

Code: Select all

[em_SelS_1]
cmd=SELECTFILESS
param=""%S:~-0,255.*.""
[em_SelS_2]
cmd=SELECTFILESS
param=""%S:~-0,255" | "*.*.*""
That solution selects the correct files if i place the cursor on DEFAULT.BAR.bak but gives me the message: "No matches found!"


This solution:

Code: Select all

TOTALCMD#BAR#DATA
SELECTFILESS
"%S:~-0,255.*." | "%S:~-0,255"
wcmicons.dll,39
Select all items with same base name as selected items|Hold Shift to also select folders


-1
seems to work universally, but can not select files with the same name but NO extension.

Re: Selecting files with same name or name+ext

Posted: 2025-04-10, 16:41 UTC
by sa16
petermad wrote:That solution give selects the correct files if i place the cursor on DEFAULT.BAR.bak but gives me the message: "No matches found!"
It is better to have the correct result with an error message than the wrong one without a message.
This is due to the need to use two commands SELECTFILES. In the TCFS2 button, I automatically suppress this message.

It would be convenient to add the suffix 0 in the SELECTFILES command to suppress error messages (similar to LOADLIST and LOADLIST0).
When select files from the buffer (cm_LoadSelectionFromClip) or file (LOADSELECTION), TC does not report errors at all.