Compare contents - when [..] is selected

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

mmm
Member
Member
Posts: 120
Joined: 2020-08-10, 12:32 UTC

Re: Compare contents - when [..] is selected

Post by *mmm »

Flasher,
I thought that Compare-By-Content is relevant for files only; not working for folders.
What am I missing?
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Compare contents - when [..] is selected

Post by *Fla$her »

2mmm
When executing cm_CompareFilesByContent, the dialog appears regardless of the type of element and even the contents of the panel (virtual folders, cm_OpenNetwork, wcx, some wfx, ftp, etc.).
Overquoting is evil! 👎
mmm
Member
Member
Posts: 120
Joined: 2020-08-10, 12:32 UTC

Re: Compare contents - when [..] is selected

Post by *mmm »

Flasher,
When the dialog appears on your screen for any of your 1-13 scenarios you listed above and you hit the Compare button, what happens?
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Compare contents - when [..] is selected

Post by *Fla$her »

2mmm
Initially, it was not about working in the dialog itself (there you can configure everything manually). We are talking only about the results of calling the command in the appropriate conditions in the file panels.

P. S.: To insert the correct nickname, use the link in the post on the left near 'by'.
Overquoting is evil! 👎
mmm
Member
Member
Posts: 120
Joined: 2020-08-10, 12:32 UTC

Re: Compare contents - when [..] is selected

Post by *mmm »

Fla$her
thanks for your feedback.
In general, there are many pitfalls.
1. If 2 folders are selected in source panel, then what?
2. If 1 folder and 1 file are selected in source panel, then what?
3. If 2 folders and 1 file are selected in source panel, then what?
4. If 1 folder and 2 files are selected in source panel, then what?
5. If 1 folder is selected in source panel and 1 folder in target, then what?
6. If there is no selection anywhere, but there are cursors on folders in both panels, then what?
7. If a folder is highlighted and cursor is on the file, then what?
8. If a folder is selected in source panel and a file is selected in target, then what?
9. If a file is selected in source panel and a folder is selected in target, then what?
10. If selected .. in source panel, and the file in target, then what?
11. If a file is selected in source panel, a .. in target, then what?
12. If selected .. in source panel, and the folder in target, then what?
13. If a folder is selected in source panel, and .. in target, then what?
'Then what' for all above:
Input validation should report a decent message telling the user that Compare-By-Content task cannot be accomplished due to invalid selection.
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Compare contents - when [..] is selected

Post by *Fla$her »

2mmm
First look at the current behavior in these conditions.
Many are annoyed by error messages. Someone would like to see a synchronization tool for selected folders and in some other cases.
Therefore, there is no unambiguous approach.
Overquoting is evil! 👎
mmm
Member
Member
Posts: 120
Joined: 2020-08-10, 12:32 UTC

Re: Compare contents - when [..] is selected

Post by *mmm »

Fla$her,
Thanks for your valuable comment. I think this conversation reached the point where you seem to have no more questions. Neither do I.

Damel,
At this point I would like to give this thread over to you again.

Important!!
As you can see my preference slightly differs from yours. You want TC to run the comparison smoothly based on best judgement whereas I would like to see (optionally) a rigorous input validation process avoiding potential confusion/ambiguity/misinterpretation. I do not sleep well due to the 3+ issue I must say.

Let's wait for a couple of weeks for comments from others; then we'll invite White for some sort of assessment/resolution.

Regards,
mmm
User avatar
petermad
Power Member
Power Member
Posts: 14739
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Compare contents - when [..] is selected

Post by *petermad »

mmm wrote: 2022-06-27, 07:17 UTC Having slept on the issue for a couple of days I take a deep breath and come up with my

Proposal:
On behalf of users from regulated industries /automotive, aerospace/ I would like to call for introducing a rigorous selection validation before running the Compare-By-Content job.

Rationale:
Any selection other than 2 regular files might indicate a hasty user action that is highly avoidable in these branches. The problem with 3+ files selected by mistake might lead to false positive if TC delivers result for files the user did not intend to compare. I find this situation potentially dangerous and TC might/should help avoid this type of human error.

Note:
Considering the very long history of current implementation that nobody apparently reported as an issue the newly-added validation might be optional/configurable.

Your thoughts?

If validation of 2 selected files is the objective then this button could do it for you:

Code: Select all

TOTALCMD#BAR#DATA
%COMSPEC% /C
if not exist "%P" (echo error) else if exist %P%S1\* (echo error) else if not *%C3==* (echo error) else if %C2==%T%S1 (echo error) else if %C2==%P%S1 (echo error) else %%COMMANDER_EXE%% /i="%%COMMANDER_INI%%" /O /S=C %C1 %C2
wcmicons.dll,49
Compare Contents - only if two files are selected

1
-1
To make the button:
1. Mark the text in the box here above (click SELECT ALL).
2. Copy it to the ClipBoard (press Ctrl+C).
3. Right click on TC's buttonbar and choose "Paste".

Since it uses the command processor for evaluation it will not work inside archives an on FTP-sites, but it will work at network shares or any drive with a drive letter.

Alternatively this command can be put in your usercmd.ini file, so you can assign a keyboard shortcut to the command.

Code: Select all

[em_comparetwofiles]
cmd=%COMSPEC% /C
param=if not exist "%P" (echo error) else if exist %P%S1\* (echo error) else if not *%C3==* (echo error) else if %C2==%T%S1 (echo error) else if %C2==%P%S1 (echo error) else %%COMMANDER_EXE%% /i="%%COMMANDER_INI%%" /O /S=C %C1 %C2
"error" in the code can be replaced with the bell character - then a beep should be heard if 2 files are not selected. You can download the code for this here: https://madsenworld.dk/tcmd/comparetwobuttons.zip - I cannot insert those bell characters here on the forum.
License #524 (1994)
Danish Total Commander Translator
TC 11.03 32+64bit on Win XP 32bit & Win 7, 8.1 & 10 (22H2) 64bit, 'Everything' 1.5.0.1371a
TC 3.50b4 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
mmm
Member
Member
Posts: 120
Joined: 2020-08-10, 12:32 UTC

Re: Compare contents - when [..] is selected

Post by *mmm »

Petermad,
Thanks for the cool button; however, I would rather see a broader discussion on Compare-By-Content action launched from the Files menu. Current implementation seems to be a tad vague and needs improvement.

-Damel calls for eliminating the [..] mark when selected by mistake.
-I myself find potentially dangerous the 3+ files situation that TC 10.00 solves on its own without so much as 'how do you do'.
-Also, I sense some contributors tend to mix Compare-By-Content with Synchronize Dirs.

Long story short, I would like the development team to initiate a detailed review of current implementation that would lead to a more robust and/or user-friendly solution (if possible) in the future.

Best,
mmm
Fla$her
Power Member
Power Member
Posts: 2244
Joined: 2020-01-18, 04:03 UTC

Re: Compare contents - when [..] is selected

Post by *Fla$her »

mmm wrote:I think this conversation reached the point where you seem to have no more questions.
I do not sleep well due to the 3+ issue I must say.
-I myself find potentially dangerous the 3+ files...
Catch the question: i.e. 13 of my items you don't think as such? Your approach is narrowly selective, however.
mmm wrote: 2022-06-28, 05:04 UTCThanks for the cool button; however, I would rather see a broader discussion on Compare-By-Content action launched from the Files menu.
Why are you focusing on the menu again? I have already given you an explanation for self-editing the mnu file. Go back to this moment.
mmm wrote: 2022-06-28, 05:04 UTCI sense some contributors tend to mix Compare-By-Content with Synchronize Dirs.
Some? Qoute:
Damel wrote: 2022-06-25, 14:00 UTCIf Compare/Synchronize directories would be seen as a clever call for the [..] then add:
Call of Compare by content function with the cursor on [..] run Compare/Synchronize directories function.
That is, we are not talking about semantic mixing, but about smart implementation when choosing an object that is not a file.
If you select 2 folders or 1/2 [..], why not offer a synchronization that compares directory structures?
An example of an analog of a smart implementation: renaming [..] causes to edit the path in the field above the file list.
mmm wrote: 2022-06-28, 05:04 UTCthe development team
Who do you mean?
And I asked questions for a reason, because up to that moment I had written a script, but then I began to think more broadly about the options.
Everything is stuck in one banality: the user can call the comparison tool not at all for the current selection of objects, but for manual configuration in the dialog. Why should the program refuse him this, throwing errors?

Therefore, I see here only a private solution with optionalization for specific needs. If there is interest, I will finish the script after a clear analysis of all the conditions.
Overquoting is evil! 👎
mmm
Member
Member
Posts: 120
Joined: 2020-08-10, 12:32 UTC

Re: Compare contents - when [..] is selected

Post by *mmm »

As my conversation with Fla$her gets a lot more complicated that I had expected and it began to dominate over the original request I am going to create a new thread focused on broader topic, leaving this one for Damel.

My vote for Damel's original request - eliminate the [..] mark if selected.
User avatar
Usher
Power Member
Power Member
Posts: 1675
Joined: 2011-03-11, 10:11 UTC

Re: Compare contents - when [..] is selected

Post by *Usher »

For me there should be enough to validate selection and issue "i" info message "Wrong selection made" for all invalid selections.
Andrzej P. Wozniak
Polish subforum moderator
User avatar
Damel
Member
Member
Posts: 130
Joined: 2003-02-06, 01:11 UTC
Location: Prague, Czech Republic

Re: Compare contents - when [..] is selected

Post by *Damel »

2 or more files -> Compare By Content... the two topmost files
less than 2 files -> nothing
- there is no need to do anything because the function Compare By Content... is supposed to compare 2 files, and in this example, the condition is not met
- doesn't matter what is in the selection (eg 1 file and X folders), no 2 files -> no action

New:
2 or more files and [..] selected -> Exclude [..] from the selection and Compare By Content... the two topmost files

Optionally:
[..] (selected or with the cursor on it BUT without any 2 files selected) -> Synchronize Dirs... or Compare Directories
Last edited by Damel on 2022-06-28, 12:53 UTC, edited 1 time in total.
The best solution:
1. format C:
2. install TotalCmd
3. install Windows (optionally)
User avatar
Damel
Member
Member
Posts: 130
Joined: 2003-02-06, 01:11 UTC
Location: Prague, Czech Republic

Re: Compare contents - when [..] is selected

Post by *Damel »

Fla$her wrote: 2022-06-28, 08:21 UTC An example of an analog of a smart implementation: renaming [..] causes to edit the path in the field above the file list.
THIS! is the type of smartness of TC I'm loving and 'm calling for here.
The best solution:
1. format C:
2. install TotalCmd
3. install Windows (optionally)
User avatar
Dalai
Power Member
Power Member
Posts: 9364
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Compare contents - when [..] is selected

Post by *Dalai »

Damel wrote: 2022-06-28, 12:41 UTCless than 2 files -> nothing
- there is no need to do anything because the function Compare By Content... is supposed to compare 2 files, and in this example, the condition is not met
It seems like you think it's a bad idea/behavior that TC automatically selects the file with the same name in the opposite panel for comparison when only one file (or none at all) is selected. If it were implemented like you suggest it would be really annoying because I use that feature a LOT! And I don't think I'm the only one. Not having to select files is one of the time-savers in such scenarios.

Regards
Dalai
#101164 Personal licence
Ryzen 5 2600, 16 GiB RAM, ASUS Prime X370-A, Win7 x64

Plugins: Services2, Startups, CertificateInfo, SignatureInfo, LineBreakInfo - Download-Mirror
Post Reply