Page 2 of 3
Re: Selecting files with same name or name+ext
Posted: 2025-03-20, 00:06 UTC
by Fla$her
petermad wrote: 2025-03-19, 23:23 UTCworks perfectly well for me with multiple dots in the name - which allso complies with the help:
It means that you are checking wrong.
If you select
name1.ext,
name1.name2.ext and
name1.name2.name3.ext will also be marked, which is an error.
on the other hand does not work as expected
Untruth. It works exactly as indicated in my description and button hint. >>>
Fla$her wrote: 2025-03-19, 21:50 UTC
It
should be done
by analogy with the following example for
the current item:
Re: Selecting files with same name or name+ext
Posted: 2025-03-20, 00:49 UTC
by petermad
If you select name1.ext, name1.name2.ext and name1.name2.name3.ext will also be marked, which is an error.
Correct - I hadn't thought of that scenario.
Untruth. It works exactly as indicated in my description and button hint.
I know that your solution is only described as working for the filename under the cursor - I even wrote that - by expected I mean as expected when trying to solve the task in
mSnus 's first post. I should probably have writen: "as requested" to make it more clear.
I don't think it can be solved for multiple selected files without using %S, and AFAIK regular expressions can only be used in the start of the parameters.
Maybe with TCFS2 ?
Re: Selecting files with same name or name+ext
Posted: 2025-03-20, 01:43 UTC
by Fla$her
I know that your solution is only described as working for the filename under the cursor - I even wrote that - by expected I mean ,,.
If you had taken into account what I have underlined, then it would not make sense to write all this.
Maybe with TCFS2 ?
No, only scripts.
Re: Selecting files with same name or name+ext
Posted: 2025-03-20, 02:23 UTC
by petermad
f you had taken into account what I have underlined, then it would not make sense to write all this.
You have proven that my solution has flaws, but it solved the the problem as it was exemplified in the first post - yours doesn't - but maybe you didn't read the first post?
If you had taken the request as described in the first post into account, the last 3 posts could have been avoided.
Re: Selecting files with same name or name+ext
Posted: 2025-03-20, 02:55 UTC
by Fla$her
You have proven that my solution has flaws, but it solved the the problem as it was exemplified in the first post - yours doesn't - but maybe you didn't read the first post?
What does this have to do with what is underlined in my sentence? Did I refer to the outdated first post in mine and provide some kind of solution to it? I quoted the answer to sniper0's question, which was not tied to the first post in any way.
If you had taken the request as described in the first post into account, the last 3 posts could have been avoided.
Wrong. It's enough just to read my original sentence carefully to clearly understand what applies to what.
Re: Selecting files with same name or name+ext
Posted: 2025-03-20, 03:00 UTC
by sniper0
Horst.Epp wrote: 2025-03-19, 11:44 UTC
There are 2 buttons from Petermad.
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
0
-1
Code: Select all
TOTALCMD#BAR#DATA
SELECTFILEST
"%S:~-0,255.*"
wcmicons.dll,39
Select all files with same base names in target panel
0
-1
tried this two, but is not what i need :/
example:
i have these files
-left panel
01.JPG
02.JPG
03.JPG
04.JPG
05.JPG
06.JPG
07.JPG
08.JPG
09.JPG
10.JPG
-right panel
01.RW2
02.RW2
03.RW2
04.RW2
05.RW2
and i want to mark the same file names (eg. 01-05).
Its just an example, normally they are not continuous
Re: Selecting files with same name or name+ext
Posted: 2025-03-20, 03:16 UTC
by petermad
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.
Re: Selecting files with same name or name+ext
Posted: 2025-03-20, 03:25 UTC
by petermad
Fla$her wrote: 2025-03-20, 02:55 UTC I quoted the answer to sniper0's question
You start your post - which is placed 2 posts below sniper0's post - with:
Horst.Epp wrote: 2025-03-19, 11:44 UTCThere are 2 buttons from Petermad.
- how would anyone know that you are addressing sniper0 and not Horst.Epp?
Re: Selecting files with same name or name+ext
Posted: 2025-03-20, 03:57 UTC
by Fla$her
petermad wrote: 2025-03-20, 03:25 UTC
- how would anyone know that you are addressing sniper0 and not Horst.Epp?
And the answer, in your opinion, is whose, if not Horst.Epp's?
Solution with the latest
Autorun beta:
autorun.cfg:
Code: Select all
LoadLibrary Plugins\Autorun_Runtime.dll
RegisterCommand 76543 SelectItemsByBaseNames
RegisterCommand 76544 SelectItemsByBaseNames 1
RegisterCommand 76545 SelectItemsByBaseNames 0 1
RegisterCommand 76546 SelectItemsByBaseNames 1 1
RegisterCommand 76547 SelectItemsByBaseNames 0 2
RegisterCommand 76548 SelectItemsByBaseNames 1 2
Func SelectItemsByBaseNames(lParam, sPanel=0, Type=0)
Local sCount = RequestInfo(11005), tCount = RequestInfo(11001 + sPanel)
If (RequestInfo(11009) And Not RequestInfo(11007) And Not sCount) Or Not tCount Then Return
Local FIdx1 = RequestInfo(11011 + sPanel)
If Type = 1 And FIdx1 = -1 Then Return
Local sList = List(), bList = Map(), i, Name, DotPos, BaseName, cList
sList.Text = sCount ? GetSelectedItems(3) : GetCurrentItem()
bList.CaseSense = False
For i = 0 To sList.Count - 1
Name = sList[i]
DotPos = StrPos(Name, '.', -1)
BaseName = DotPos ? StrLeft(Name, DotPos - 1) : Name
If Not bList.Has(BaseName) Then bList.Set(BaseName)
Next
Free(sList)
Local LoopStart = (Type = 1 ? FIdx1 : (RequestInfo(11009 + sPanel) ? 1 : 0)), _
LoopEnd = (FIdx1 = -1 ? tCount : RequestInfo(11001 + sPanel + (Type = 2 ? 10 : 0)))
If LoopStart > tCount Then Return
For i = LoopStart To LoopEnd - 1
Name = StrPart(SendMessage(RequestInfo(3 + sPanel), 0x0189, i, 0, 2), auTAB, 1)
DotPos = StrPos(Name, '.', -1)
BaseName = DotPos ? StrLeft(Name, DotPos - 1) : Name
If bList.Has(BaseName) Then
If FIdx1 = -1 Or i < FIdx1 Then Name &= '\'
cList &= Name & auLF
EndIf
Next
If cList <> '' Then
ClipGet Clip
ClipPut(cList)
If sPanel Then SendCommand(4006, 0, 1)
SendCommand(2033, 0, 1)
If sPanel Then SendCommand(4006)
ClipPut(Clip)
EndIf
Free(bList)
EndFunc
Totalcmd.inc:
cm_RightViewMode9=8259;etc. until 8499
cm_SelectItemsByBaseNames=76543
cm_SelectItemsByBaseNamesT=76544; T - select in the target panel
cm_SelectFilesByBaseNames=76545
cm_SelectFilesByBaseNamesT=76546
cm_SelectFoldersByBaseNames=76547
cm_SelectFoldersByBaseNamesT=76548
I suppose everything is clear from the command names.
Re: Selecting files with same name or name+ext
Posted: 2025-03-20, 11:59 UTC
by sa16
If the extensions are more or less standard (for example, no more than 4 characters), and the names can be with multiple dots:
Code: Select all
TOTALCMD#BAR#DATA
SELECTFILESS
"%S:~-0,255" "%S:~-0,255.?" "%S:~-0,255.??" "%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
P.S. But the problem remains if there are more points in the sample than in another selected file:
DEFAULT.BAR.bak will also select
DEFAULT.BAR
Re: Selecting files with same name or name+ext
Posted: 2025-03-20, 13:21 UTC
by petermad
2sa16
I tried that too, but it will falsely mark for example name1.12.3 or name1.1.23 if the file name1.txt is marked - but it is better
The more characters you allow in the extension, the bigger risk of false markings.
Re: Selecting files with same name or name+ext
Posted: 2025-03-20, 13:27 UTC
by petermad
Fla$her wrote: 2025-03-20, 03:57 UTC
cm_SelectFoldersByBaseNamesT=765484
I suppose everything is clear from the command names.
I think it should be: cm_SelectFoldersByBaseNamesT=76548
Re: Selecting files with same name or name+ext
Posted: 2025-03-20, 16:53 UTC
by Fla$her
Thanks. Fixed.
Re: Selecting files with same name or name+ext
Posted: 2025-03-20, 18:05 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:
Please check! In my opinion, the line start character (
^) is missing in the regular expression:
<
^%O\.?[^.]*$
Re: Selecting files with same name or name+ext
Posted: 2025-03-20, 23:11 UTC
by Fla$her
I just forgot it. Added.