Folder help please (cm_GoToFirstEntry)
Moderators: Hacker, petermad, Stefan2, white
Re: Folder help please (cm_GoToFirstEntry)
solid,
All internal commands. See totalcmd.inc or execute cm_commandbrowser.
HTH
Roman
All internal commands. See totalcmd.inc or execute cm_commandbrowser.
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: Folder help please (cm_GoToFirstEntry)
2Hacker
Thx. That is very convenient.
Thx. That is very convenient.
Re: Folder help please (cm_GoToFirstEntry)
Thank you so much for this. It works. Can you help me tweak the script so it *always* selects the first file/folder in the directory, regardless of when the last time I entered it was? I keep having to enter the same directory twice in order for the AHK script to activate. Sometimes it doesn't at all work. I can't seem to just get it working for any folder, any time. It's hard to predict when this AHK will function. Can you assist>?Hacker wrote: 2022-03-12, 19:00 UTC linuxy,
Here is an AHK script that reacts to Enter being pressed and after checking if a subdir has been entered sets the focus on the first item:HTHCode: Select all
Global PreviousTcPath PreviousTcPath := GetCurrentTcPath() #IfWinActive, ahk_class TTOTAL_CMD ~$Enter:: SetTimer, StopChecking, -5000 SetTimer, CheckAndSetToFirstItem, 50 Return CheckAndSetToFirstItem() { CurrentTcPath := GetCurrentTcPath() If (CurrentTcPath = PreviousTcPath) Return If ((StrLen(CurrentTcPath) > StrLen(PreviousTcPath)) && InStr(CurrentTcPath, PreviousTcPath)) { SendMessage, 1075, 2049, , , ahk_class TTOTAL_CMD SetTimer, CheckAndSetToFirstItem, Off SetTimer, StopChecking, Off } PreviousTcPath := CurrentTcPath } StopChecking() { SetTimer, CheckAndSetToFirstItem, Off } GetCurrentTcPath() { SendMessage, 1074, 17, , , ahk_class TTOTAL_CMD WinGetText, PathInTC, ahk_id %ErrorLevel% Return, SubStr(PathInTC, 1, -3) . "\" }
Roman
I would like it to always activate, please? Thank you kindly.
Re: Folder help please (cm_GoToFirstEntry)
Hier my TC button which always goes to the newest entry,
which I find more usefull than the first file.
which I find more usefull than the first file.
Code: Select all
TOTALCMD#BAR#DATA
cmd.exe
/k "for /f "usebackq delims=" %%f in (`dir /b /a-d /o-d`) do start "" "%%COMMANDER_EXE%%" /O /S /L="%%~ff\:" & exit"
C:\Tools\Wincmd\Icons\Down-Blue.ico
Newest File
1
-1
Windows 11 Home, Version 24H2 (OS Build 26100.3915)
TC 11.55 RC1 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
TC 11.55 RC1 x64 / x86
Everything 1.5.0.1391a (x64), Everything Toolbar 1.5.2.0, Listary Pro 6.3.2.88
QAP 11.6.4.2.1 x64
Re: Folder help please (cm_GoToFirstEntry)
linuxy
Another solution with Autootkey V1.
Set shorcut
And user command like
(with your paths)
Enter.ahk
Limitation - Script didn't work in archives.
I don't know way to check if we inside archive or if cursor on archive file.
WM_USER+50 didn't give such information.
But somehow TC can detect it (and even have parameter /A).
Another solution with Autootkey V1.
Set shorcut
Code: Select all
[Shortcuts]
Enter=em_Enter
Code: Select all
[em_Enter]
cmd=%commander_path%\Scripts\AutoHotkeyU32.exe "%commander_path%\Scripts\Enter.ahk"
param=%Z%P%N
Enter.ahk
Code: Select all
#NoEnv
#NoTrayIcon
#SingleInstance force
SetBatchLines, -1
If not ( WinExist("ahk_class TTOTAL_CMD") || WinActive("ahk_class TTOTAL_CMD") )
ExitApp
WinGet, hw_TTOTAL_CMD, ID, A
; Get Active Panel
SendMessage, 1074, 1000, 0,, ahk_class TTOTAL_CMD
TCPanelA := ErrorLevel
; Get index of first item (0 if there is no updir, 1 otherwise)
SendMessage, 1074, 1008 + TCPanelA, 0,, ahk_class TTOTAL_CMD
TCUpDirAP := ErrorLevel
; Get index of current item (caret)
SendMessage, 1074, 1006 + TCPanelA, 0,, ahk_class TTOTAL_CMD
TCPositionAP := ErrorLevel
SendMessage, 1075, 1001,,, ahk_class TTOTAL_CMD
; If cursor NOT at [..]
if not ( (TCUpDirAP = 1) & (TCPositionAP = 0) )
TargetFile = %1%
if InStr(FileExist(TargetFile), "D")
SendMessage, 1075, 2049,,, ahk_class TTOTAL_CMD
ExitApp
Limitation - Script didn't work in archives.
I don't know way to check if we inside archive or if cursor on archive file.
WM_USER+50 didn't give such information.
But somehow TC can detect it (and even have parameter /A).
"I used to feel guilty in Cambridge that I spent all day playing games, while I was supposed to be doing mathematics. Then, when I discovered surreal numbers, I realized that playing games IS math." John Horton Conway
Re: Folder help please (cm_GoToFirstEntry)
I do appreciate all this help, but it seems silly to go through all this lol just being able to hide/disable the "parent [..]" would make this problem go away I never understand why it's just like toxic and never going to happen. Oh well.
No need for AHK scripts, or hacks. Maybe someday, I can dream right? lol
Some people are used to (and prefer) when they open a folder, the focus is on the first item/folder in the directory. Not a pair of dots [..] that literally bring you right back out up a directory lol this is the default in Windows, Linux, OSX, hehe. But TC is special!

Some people are used to (and prefer) when they open a folder, the focus is on the first item/folder in the directory. Not a pair of dots [..] that literally bring you right back out up a directory lol this is the default in Windows, Linux, OSX, hehe. But TC is special!
Re: Folder help please (cm_GoToFirstEntry)
Can you please tell me where to paste this button code? Thank you!Horst.Epp wrote: 2023-06-07, 20:15 UTC Hier my TC button which always goes to the newest entry,
which I find more usefull than the first file.Code: Select all
TOTALCMD#BAR#DATA cmd.exe /k "for /f "usebackq delims=" %%f in (`dir /b /a-d /o-d`) do start "" "%%COMMANDER_EXE%%" /O /S /L="%%~ff\:" & exit" C:\Tools\Wincmd\Icons\Down-Blue.ico Newest File 1 -1
Re: Folder help please (cm_GoToFirstEntry)
Create a Button in the Buttonbar (copy/paste CODE)
- Click on "SELECT ALL" (to the right of CODE:), then press CTRL+C (copy to clipboard).
- Right-click on any place in the button bar, then click on "Paste".
⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺ - Option1: Point to the new button (slightly longer): 'Tooltip' is shown (-> description to the button).
A maximum of 259 characters is allowed for the tooltip. | = create line break, || = create | as separator character. - Option2: Button bar - "Tooltip" field: A single space deactivates the display of the tooltip.
If the "Tooltip" field is empty, the content of the "Command" field is displayed. - Option3: See FAQs and explanation: Button-code (TOTALCMD#BAR#DATA) <-- <Ctrl+click on the link...>
Re: Folder help please (cm_GoToFirstEntry)
WRONG! Its default two panel filemanager behaviour since Dos & Norton Commander

Hoecker sie sind raus!
Re: Folder help please (cm_GoToFirstEntry)
I did that but I can't find where to paste it all. Parameters? code? Command?tuska wrote: 2023-06-08, 00:40 UTCCreate a Button in the Buttonbar (copy/paste CODE)
- Click on "SELECT ALL" (to the right of CODE:), then press CTRL+C (copy to clipboard).
- Right-click on any place in the button bar, then click on "Paste".
⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺⸺- Option1: Point to the new button (slightly longer): 'Tooltip' is shown (-> description to the button).
A maximum of 259 characters is allowed for the tooltip. | = create line break, || = create | as separator character.- Option2: Button bar - "Tooltip" field: A single space deactivates the display of the tooltip.
If the "Tooltip" field is empty, the content of the "Command" field is displayed.- Option3: See FAQs and explanation: Button-code (TOTALCMD#BAR#DATA) <-- <Ctrl+click on the link...>
Thanks!
Re: Folder help please (cm_GoToFirstEntry)
You do not open a button and paste anyting - you simply copy the code - for example:did that but I can't find where to paste it all. Parameters? code? Command?
Code: Select all
TOTALCMD#BAR#DATA
cmd.exe
/k "for /f "usebackq delims=" %%f in (`dir /b /a-d /o-d`) do start "" "%%COMMANDER_EXE%%" /O /S /L="%%~ff\:" & exit"
C:\Tools\Wincmd\Icons\Down-Blue.ico
Newest File
1
-1
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: Folder help please (cm_GoToFirstEntry)
Oh wow, I never knew that! That's amazing!! Thanks for that tippetermad wrote: 2023-06-08, 01:55 UTCYou do not open a button and paste anyting - you simply copy the code - for example:did that but I can't find where to paste it all. Parameters? code? Command?by clicking "select all" in the top of the box here above, and press Ctrl+C . Then you go to TC, right-click on an empty spot on your buttonbar and choose "Paste" - Then TC will make the button for you.Code: Select all
TOTALCMD#BAR#DATA cmd.exe /k "for /f "usebackq delims=" %%f in (`dir /b /a-d /o-d`) do start "" "%%COMMANDER_EXE%%" /O /S /L="%%~ff\:" & exit" C:\Tools\Wincmd\Icons\Down-Blue.ico Newest File 1 -1

Re: Folder help please (cm_GoToFirstEntry)
This works great, but it only works every *other* time, why is that? Like, when I go in and out of a folder, twice. It works every other folder instance. How can I make it always perform this action, not just every other instance or?Hacker wrote: 2022-03-12, 19:00 UTC linuxy,
Here is an AHK script that reacts to Enter being pressed and after checking if a subdir has been entered sets the focus on the first item:HTHCode: Select all
Global PreviousTcPath PreviousTcPath := GetCurrentTcPath() #IfWinActive, ahk_class TTOTAL_CMD ~$Enter:: SetTimer, StopChecking, -5000 SetTimer, CheckAndSetToFirstItem, 50 Return CheckAndSetToFirstItem() { CurrentTcPath := GetCurrentTcPath() If (CurrentTcPath = PreviousTcPath) Return If ((StrLen(CurrentTcPath) > StrLen(PreviousTcPath)) && InStr(CurrentTcPath, PreviousTcPath)) { SendMessage, 1075, 2049, , , ahk_class TTOTAL_CMD SetTimer, CheckAndSetToFirstItem, Off SetTimer, StopChecking, Off } PreviousTcPath := CurrentTcPath } StopChecking() { SetTimer, CheckAndSetToFirstItem, Off } GetCurrentTcPath() { SendMessage, 1074, 17, , , ahk_class TTOTAL_CMD WinGetText, PathInTC, ahk_id %ErrorLevel% Return, SubStr(PathInTC, 1, -3) . "\" }
Roman
Thanks!

Re: Folder help please (cm_GoToFirstEntry)
linuxy,
So do I understand correctly, that when you are in C:\UpFolder\SubFolder, and go up to C:\UpFolder, you want the cursor not to be placed on SubFolder, but on the first item in UpFolder?
Roman
So do I understand correctly, that when you are in C:\UpFolder\SubFolder, and go up to C:\UpFolder, you want the cursor not to be placed on SubFolder, but on the first item in UpFolder?
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.