Automatically focus cursor on copied file/folder
Moderators: Hacker, petermad, Stefan2, white
-
- Junior Member
- Posts: 11
- Joined: 2019-04-21, 18:38 UTC
Automatically focus cursor on copied file/folder
Hello!
I noticed that when I'm creating a new folder in Total Commander, it will be automatically selected after I create it (cursor moves on the new created folder). It is possible to have the same behavior when i occasionally copy a file/folder from other application (e.g. WinRar, File Explorer) to Total Commander?
I noticed that when I'm creating a new folder in Total Commander, it will be automatically selected after I create it (cursor moves on the new created folder). It is possible to have the same behavior when i occasionally copy a file/folder from other application (e.g. WinRar, File Explorer) to Total Commander?
Re: Automatically focus cursor on copied file/folder
No, but you can have TC temporarily putting files added from other programs to the end of the list:
"Configuration" -> "Options..." -> "Refresh" -> "Put added files at the END of the file list (default. sorted)"
"Configuration" -> "Options..." -> "Refresh" -> "Put added files at the END of the file list (default. sorted)"
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
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
-
- Junior Member
- Posts: 11
- Joined: 2019-04-21, 18:38 UTC
Re: Automatically focus cursor on copied file/folder
Hi friends
Is there any way to do this yet?
When you copy a file or folder, I'm so accustomed to the file/folder being selected/focused when the copy is complete. For decades now. I can't unlearn it lol. This is the default behavior in Windows Explorer, XYplorer, all Linux file managers I've used, so I'm not understanding why can't TC offer this?
It's so inconvenient to copy a file into a folder and not have the ability to quickly interact with it; i.e. have it selected/focused when the copy is complete.
Yes, I know in TC you can "put" the added/copied file to the end of the folder but seriously, that doesn't fix anything. That's not the same thing as this expected behavior, plus TC doesn't even select the file in that case either lol so it's not the solution. It just moves the file to the end of the folder. I'd still need to hit an extra keypress to select it ("end"), so that's not ideal.
So I ask: can someone please help me find a way to automatically focus the copied/moved file in TC because it would be so helpful in my day to day operations moving files, etc. This seems very reasonable to me, I'm happy to sponsor this if it's not already doable with a script or setting.
I can't see why anyone would object to this being an option, considering.
Thank you!
PS. I'm not even talking about copying from *other* programs - I mean even just copying from control C and control V inside of TC, that doesn't even highlight the copied file.
I still have to go find the file, or hit "end" to jump to it, every time.
Is there any way to do this yet?
When you copy a file or folder, I'm so accustomed to the file/folder being selected/focused when the copy is complete. For decades now. I can't unlearn it lol. This is the default behavior in Windows Explorer, XYplorer, all Linux file managers I've used, so I'm not understanding why can't TC offer this?
It's so inconvenient to copy a file into a folder and not have the ability to quickly interact with it; i.e. have it selected/focused when the copy is complete.
Yes, I know in TC you can "put" the added/copied file to the end of the folder but seriously, that doesn't fix anything. That's not the same thing as this expected behavior, plus TC doesn't even select the file in that case either lol so it's not the solution. It just moves the file to the end of the folder. I'd still need to hit an extra keypress to select it ("end"), so that's not ideal.
So I ask: can someone please help me find a way to automatically focus the copied/moved file in TC because it would be so helpful in my day to day operations moving files, etc. This seems very reasonable to me, I'm happy to sponsor this if it's not already doable with a script or setting.
I can't see why anyone would object to this being an option, considering.
Thank you!
PS. I'm not even talking about copying from *other* programs - I mean even just copying from control C and control V inside of TC, that doesn't even highlight the copied file.

Re: Automatically focus cursor on copied file/folder
By the way, TC already does this sort of thing (correctly), when you hit F7 and make a new folder. It automatically selects the new folder! Can you imagine if it made a new folder and then left you in a huge list of files and you have to navigate to your new folder? lol no thanks 
So, if TC can automatically focus on a newly created folder via F7, how can I have TC automatically select/focus a copied/moved file, as though it was a new created one?
Thanks so much!

So, if TC can automatically focus on a newly created folder via F7, how can I have TC automatically select/focus a copied/moved file, as though it was a new created one?
Thanks so much!
Re: Automatically focus cursor on copied file/folder
*.*,
This AHK script snippet gets the first selected file and sets the focus to the same file name in the target list. Not sure how best to wrap it to get the desired functionality automagically, though. The files which are being copied must still be selected for the script to get the correct file name, and then we have to wait until the copy or move finishes, which can be done using F5, F6, in the foreground, background, BTM, using D&D, Ctrl-C/X - Ctrl-V, and it starts getting complex here.
Roman
This AHK script snippet gets the first selected file and sets the focus to the same file name in the target list. Not sure how best to wrap it to get the desired functionality automagically, though. The files which are being copied must still be selected for the script to get the correct file name, and then we have to wait until the copy or move finishes, which can be done using F5, F6, in the foreground, background, BTM, using D&D, Ctrl-C/X - Ctrl-V, and it starts getting complex here.
Code: Select all
TcPath = C:\Programy\Totalcmd\TOTALCMD64.exe
ClipboardBak = %ClipboardAll%
Clipboard =
; Get a list of selected files through the clipboard
PostMessage, 1075, 2017, , , ahk_class TTOTAL_CMD
ClipWait, 2
If (ErrorLevel != 0)
{
Clipboard = %ClipboardBak%
ClipboardBak =
MsgBox, Couldn't get source filename. Exiting.
Return
}
; Get the name of the first selected file
FileName := InStr(Clipboard, "`n") ? SubStr(Clipboard, 1, InStr(Clipboard, "`n") - 2) : Clipboard
Clipboard = %ClipboardBak%
ClipboardBak =
; Set focus to target panel
PostMessage, 1075, 4006, , , ahk_class TTOTAL_CMD
; Get path of target panel
SendMessage, 1074, 1000, , , ahk_class TTOTAL_CMD
SendMessage, 1074, 8 + ErrorLevel, , , ahk_class TTOTAL_CMD
ControlGetText, TargetPath, , ahk_id %ErrorLevel%
TargetPath := SubStr(TargetPath, 1, InStr(TargetPath, "\", , 0) - 1)
; Set focus to the file that has been copied
Run, %TcPath% /O /S /A /P "/L=%TargetPath%\%FileName%"
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Re: Automatically focus cursor on copied file/folder
2linuxy
You can use this button to go to the file with the same name in the opposite panel:
You can use this button to go to the file with the same name in the opposite panel:
Code: Select all
TOTALCMD#BAR#DATA
cm_ClearAll,cm_Select 1,cm_CopyNamesToClip,cm_ClearAll,cm_FocusTrg,cm_ClearAll,cm_LoadSelectionFromClip,cm_GoToFirstEntry,cm_GotoNextSelected,cm_ClearAll
wcmicons.dll,37
Go to file with same name in opposite side, if it exists.
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".
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
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
Re: Automatically focus cursor on copied file/folder
Thank you for this help. I hope one day this behavior is offered in TC without the need for these tweaks. It seems doable since TC already does this behavior when you create a new folder, I wish it was consistent and did the same when you copy a folder or file.
Re: Automatically focus cursor on copied file/folder
agree! I run into the same problem when I'm copying to a folder with numerous files and have to spend time clicking "Arrange by date" to see if the file is listed. And then return the location of the files to the original order ... "A trifle", but unpleasant. Especially when you do it hundreds and hundreds of times a daylinuxy wrote: 2023-06-14, 21:00 UTC Thank you for this help. I hope one day this behavior is offered in TC without the need for these tweaks. It seems doable since TC already does this behavior when you create a new folder, I wish it was consistent and did the same when you copy a folder or file.
Re: Automatically focus cursor on copied file/folder
2linuxy & 2Seyran_72
What should happen if you copy more than one file - should TC go to the file that corresponds to the file under the cursor in the source side (which might not even had been selected for copying) or to the last selected file, or to the last copied file, or to the first selected/copied files?
Or should it only work when one item is copied?
What should happen if you copy more than one file - should TC go to the file that corresponds to the file under the cursor in the source side (which might not even had been selected for copying) or to the last selected file, or to the last copied file, or to the first selected/copied files?
Or should it only work when one item is copied?
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
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
Re: Automatically focus cursor on copied file/folder
it would be nice if it worked AT LEAST for one file)))petermad wrote: 2023-06-19, 09:04 UTC 2linuxy & 2Seyran_72
What should happen if you copy more than one file - should TC go to the file that corresponds to the file under the cursor in the source side (which might not even had been selected for copying) or to the last selected file, or to the last copied file, or to the first selected/copied files?
Or should it only work when one item is copied?
Re: Automatically focus cursor on copied file/folder
Hi, Hacker, in your AutoHotkey script the path is copied to the "TargetPath" variable. Can the same be done for the file name, which is now copied to the clipboard?Hacker wrote: 2023-06-09, 21:58 UTC *.*,
This AHK script snippet gets the first selected file and sets the focus to the same file name in the target list. Not sure how best to wrap it to get the desired functionality automagically, though. The files which are being copied must still be selected for the script to get the correct file name, and then we have to wait until the copy or move finishes, which can be done using F5, F6, in the foreground, background, BTM, using D&D, Ctrl-C/X - Ctrl-V, and it starts getting complex here.RomanCode: Select all
TcPath = C:\Programy\Totalcmd\TOTALCMD64.exe ClipboardBak = %ClipboardAll% Clipboard = ; Get a list of selected files through the clipboard PostMessage, 1075, 2017, , , ahk_class TTOTAL_CMD ClipWait, 2 If (ErrorLevel != 0) { Clipboard = %ClipboardBak% ClipboardBak = MsgBox, Couldn't get source filename. Exiting. Return } ; Get the name of the first selected file FileName := InStr(Clipboard, "`n") ? SubStr(Clipboard, 1, InStr(Clipboard, "`n") - 2) : Clipboard Clipboard = %ClipboardBak% ClipboardBak = ; Set focus to target panel PostMessage, 1075, 4006, , , ahk_class TTOTAL_CMD ; Get path of target panel SendMessage, 1074, 1000, , , ahk_class TTOTAL_CMD SendMessage, 1074, 8 + ErrorLevel, , , ahk_class TTOTAL_CMD ControlGetText, TargetPath, , ahk_id %ErrorLevel% TargetPath := SubStr(TargetPath, 1, InStr(TargetPath, "\", , 0) - 1) ; Set focus to the file that has been copied Run, %TcPath% /O /S /A /P "/L=%TargetPath%\%FileName%"
Where can I find out where each number sent to PostMessage or SendMessage came from, and valid for Total Commander?
Re: Automatically focus cursor on copied file/folder
wetware05,
HTH
Roman
You mean if the variable FileName can be appended to TargetPath? Sure:the path is copied to the "TargetPath" variable. Can the same be done for the file name, which is now copied to the clipboard?
Code: Select all
TargetPath = %TargetPath%\%FileName%
In totalcmd.inc or in cm_commandbrowser.Where can I find out where each number sent to PostMessage or SendMessage came from, and valid for Total Commander?
HTH
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.
Re: Automatically focus cursor on copied file/folder
hi, Hacker, but in the command TargetPath = %TargetPath%\%FileName%, the variable "FileName" has been extracted from clipboard. I don't want to use the clipboard in an intermediary way. I use a clipboard manager and if I use that command it is constantly giving me notices of what it copies to the clipboard. I want the equivalent of...Hacker wrote: 2023-06-20, 19:54 UTC wetware05,You mean if the variable FileName can be appended to TargetPath? Sure:the path is copied to the "TargetPath" variable. Can the same be done for the file name, which is now copied to the clipboard?Code: Select all
TargetPath = %TargetPath%\%FileName%
In totalcmd.inc or in cm_commandbrowser.Where can I find out where each number sent to PostMessage or SendMessage came from, and valid for Total Commander?
HTH
Roman
Code: Select all
SendMessage, 1074, 1000, , , ahk_class TTOTAL_CMD
SendMessage, 1074, 8 + ErrorLevel, , , ahk_class TTOTAL_CMD
ControlGetText, TargetPath, , ahk_id %ErrorLevel%
sPath := SubStr(TargetPath, 1, InStr(TargetPath, "\", , 0) - 1)
Re: Automatically focus cursor on copied file/folder
wetware05,
Roman
Not in a way I would know of. The file under the cursor yes, but not the selected files. Perhaps the selection could be saved to a file, the file then read by the script and deleted, but that seems cumbersome. Perhaps someone has a better idea?That the file name is copied into a variable directly, without going through the clipboard, or is it not possible?
Roman
Mal angenommen, du drückst Strg+F, wählst die FTP-Verbindung (mit gespeichertem Passwort), klickst aber nicht auf Verbinden, sondern fällst tot um.