Find same file name both sides

English support forum

Moderators: Hacker, petermad, Stefan2, white

User avatar
sjxyz
Junior Member
Junior Member
Posts: 6
Joined: 2014-10-15, 08:14 UTC
Location: UK

Find same file name both sides

Post by *sjxyz »

Is there an easy way to find a file with the same name in the opposite window? Maybe the windows are sorted in different orders... Compare By Content finds the other file without it being selected, and shows the differences, but it doesn't leave the file selected, and gives me more information than I need. Any help appreciated...
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1052
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

If you're just trying to select the same files in both file lists this should work:

New button with command:

Code: Select all

cm_FocusLeft,cm_CopyNamesToClip,cm_FocusRight,cm_LoadSelectionFromClip
Your selection has to be in the left file list and your previous clipboard content will be overwritten.

@ghisler:
We still need a cm_SWITCH_FILELIST_AKA_[TAB]


*edit: Added "cm_FocusLeft" to make sure the left side is active
Last edited by ZoSTeR on 2014-10-15, 19:31 UTC, edited 2 times in total.
seb-
Senior Member
Senior Member
Posts: 276
Joined: 2011-11-15, 06:14 UTC
Location: DE\BN - only part time TC user after switching to Linux ;)

Post by *seb- »

I like your suggestion, thanks for this handy one!
ZoSTeR wrote:
@ghisler:
We still need a cm_SWITCH_FILELIST_AKA_[TAB]
Yes. I strongly agree.

I copied the commands you mentioned into a new button and soon realized it only works (as you mentioned, but i have not read in the first place ;)) one way but not the other...

some cm_command to do what the TAB button does, would be very nice for this to work both ways.
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

em_SWITCH_FILELIST cm_tab // TC9: cm_FocusTrg

Post by *Stefan2 »

 

%Commander_Path%\usercmd.ini

Code: Select all

[em_SWITCH_FILELIST]
cmd=%Commander_Path%\TOOLs\NirSoft\nircmd.exe sendkey tab press

From Compare filenames without extension





EDIT:
cm_TAB a.k.a. cm_FocusTrg
HISTORY.TXT TC9.0 beta1 wrote:27.04.16 Added: New internal commands cm_FocusSrc and cm_FocusTrg
to put cursor in source/target panel (32/64)


 
Last edited by Stefan2 on 2016-06-10, 13:19 UTC, edited 1 time in total.
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Post by *MVV »

Using just TC (preserve clipboard contents, no focus switch):

Code: Select all

Command: %COMMANDER_EXE%
Parameters: /O /S /R="%T%N"
Using TCFS2 (same thing but faster):

Code: Select all

Command: TCFS2.exe
Parameters: /ef "tcd(, `%T%O.%E`, s)"
Jump to file in other panel and switch focus to it:

Code: Select all

Command: TCFS2.exe
Parameters: /ef "tcd(, `%T%O.%E`, s) send({tab})"
Here send({tab}) may be replaced with tcm(L_isActive ? 4002 : 4001) if TCFS2Tools is installed too.
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1052
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

Yes we had this discussion before and I'm aware of the workarounds.

But plastering a potential one line answer with several links to additional programs is not really efficient.
User avatar
sjxyz
Junior Member
Junior Member
Posts: 6
Joined: 2014-10-15, 08:14 UTC
Location: UK

Post by *sjxyz »

Thanks ZoSTeR: that's great. Made myself the other handed one as well, with a button at each side of the screen!
Wondering if it's possible to get the focus to move to that selected file - when I have more than a screenful of files, I can't instantly see if it's found a match or not.
User avatar
ZoSTeR
Power Member
Power Member
Posts: 1052
Joined: 2004-07-29, 11:00 UTC

Post by *ZoSTeR »

You could add "cm_GotoNextSelected" or "cm_ShowOnlySelected"
cm_GotoNextSelected doesn't neccessarly jump to the first selected file.

The summary below the file list also shows the number of selected files.

For the "ShowOnlySelected" variant you have to restore the view after the first use with "cm_RightAllFiles":

Code: Select all

cm_FocusLeft,cm_CopyNamesToClip,cm_FocusRight,cm_RightAllFiles,cm_LoadSelectionFromClip,cm_ShowOnlySelected
User avatar
sjxyz
Junior Member
Junior Member
Posts: 6
Joined: 2014-10-15, 08:14 UTC
Location: UK

Post by *sjxyz »

Great! Thanks ZoSTeR. I prefer the GotoNextSelected in fact.
mrle
Junior Member
Junior Member
Posts: 58
Joined: 2005-04-25, 21:44 UTC

Re: em_SWITCH_FILELIST cm_tab cm_SWITCH_FILELIST

Post by *mrle »

Stefan2 wrote: 
%Commander_Path%\usercmd.ini

Code: Select all

[em_SWITCH_FILELIST]
cmd=%Commander_Path%\TOOLs\NirSoft\nircmd.exe sendkey tab press
 
So, why this (button) is not working?

Code: Select all

cm_CopyNamesToClip,em_SwitchFilelist,cm_LoadSelectionFromClip
1. TC pick up selected filename(s) to clpboard - OK.
2. Nircmd switch focus to other panel - OK.
3. Nothing happens with file(s) with same name and extension - ?
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: em_SWITCH_FILELIST cm_tab cm_SWITCH_FILELIST

Post by *Stefan2 »

mrle wrote:
Stefan2 wrote: 
%Commander_Path%\usercmd.ini

Code: Select all

[em_SWITCH_FILELIST]
cmd=%Commander_Path%\TOOLs\NirSoft\nircmd.exe sendkey tab press
 
So, why this (button) is not working?
Yes, sorry. In the meantime I can imagine why it not works:

because all commands are fired up (nearly) the same time after button press and do not work one after the other, as far as I see. I think we need a 'wait' command here too.


- - -

You can try to use nircmd in a batch file
as we have done in the linked post
and use that in your button.
There you can add commands to do a pause, like ping or timeout.

Something like:

Code: Select all

@ECHO OFF
SET nirc=%Commander_Path%\TOOLs\NirSoft\nircmdc.exe 

REM cm_CopyNamesToClip
%nirc% win sendmsg class TTOTAL_CMD 1075, 2017, 0 

REM wait 2 seconds:
PING -n 2 127.0.0.1 >NUL

REM em_SwitchFilelist
%nirc% sendkey tab press

REM cm_LoadSelectionFromClip
%nirc% win sendmsg class TTOTAL_CMD 1075, 2033, 0
More commands in \TOTALCMD.INC

---- EDIT

Improved script:


Code: Select all

@ECHO OFF
SET nirc=%Commander_Path%\TOOLs\NirSoft\nircmdc.exe

REM be sure to work on the TC window
%nirc% win activate class TTOTAL_CMD
REM I don't know why the  windows is resized, so this is need too:
%nirc% win max class TTOTAL_CMD 

REM cm_CopyNamesToClip
%nirc% win sendmsg class TTOTAL_CMD 1075, 2017, 0

REM wait 1 second:
%nirc% wait 1000 

REM em_SwitchFilelist
%nirc% sendkey tab press

REM cm_LoadSelectionFromClip
%nirc% win sendmsg class TTOTAL_CMD 1075, 2033, 0


 
Last edited by Stefan2 on 2014-11-10, 15:29 UTC, edited 1 time in total.
mrle
Junior Member
Junior Member
Posts: 58
Joined: 2005-04-25, 21:44 UTC

Re: em_SWITCH_FILELIST cm_tab cm_SWITCH_FILELIST

Post by *mrle »

Stefan2 wrote:because all commands are fired up (nearly) the same time after button press
Yes, almost certainly.

Problem with bat is that cmd.exe takes focus (while pinging localhost), so nircmd is sending "tab press" to its window.

... But never mind, it's not matter to me. Please don't waste your time.
Thanks.
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: em_SWITCH_FILELIST cm_tab cm_SWITCH_FILELIST

Post by *Stefan2 »

mrle wrote:
Stefan2 wrote:Problem with bat is that cmd.exe takes focus
Right. I had missed some parts to copy from the linked script, and I worked to quick&dirty, sorry.
I have now updated my script above, just for the record. (It still have some problems)



 
User avatar
MVV
Power Member
Power Member
Posts: 8711
Joined: 2008-08-03, 12:51 UTC
Location: Russian Federation

Re: em_SWITCH_FILELIST cm_tab cm_SWITCH_FILELIST

Post by *MVV »

Stefan2 wrote:Something like:
Stefan2 wrote:Improved script:
This command works w/o mentioned problems (doesn't change window size, doesn't eat focus when started from buttonbar or via hotkey):

Code: Select all

TCFS2 /ef "tcm(2017) delay(2000) send(`{tab}`) tcm(2033)"
However it doesn't focus file, it just selects it. Much better commands were written by me above.
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: em_SWITCH_FILELIST cm_tab cm_SWITCH_FILELIST

Post by *Stefan2 »

MVV wrote: Much better commands were written by me above.
Sure, stay cool :D , there are always different ways of doing things. Yours are fine too (I guess, still not tested :oops: )



But

Code: Select all

TCFS2 /ef "tcm(2017) delay(2000) send(`{tab}`) tcm(2033)"
looks like worthy to try.


 
Post Reply