Page 1 of 1

New command: cm_GoToNewItem

Posted: 2018-05-17, 07:16 UTC
by dragonetti
Suggestion (request):
Could there be a command implemented which works almost like
"cm_GoToFirstFile" but now "cm_GoToNewItem" puts cursor on the last (newest) created file or folder.
(Maybe also add a command hat puts cursor on the oldest created file/folder)

Question:
Is there a way through a command to put the cursor on a specific file or folder within the left or right pane?

With "place cursor" I mean the state when you left click on a file or folder in the left or right pane. The selected file/folder becomes blue selected just like in windows explorer when you left click a file or folder. (I do not want to red mark-select file/folder).

Select newest youngest oldest file

Posted: 2018-05-17, 08:13 UTC
by Stefan2
Take a look if this will work for you:

create an button with this internal commands:



(Select newest file)

cm_SrcByDateTime,cm_GoToFirstFile,cm_SrcByName


-or-

(Select oldest file)

cm_SrcByDateTime,cm_SrcNegOrder,cm_GoToFirstFile,cm_SrcByName





- - -

Find more commands in the "TOTALCMD.INC" text file, like:

cm_GoToFirstFile=2050;Place cursor on first file in list
cm_SrcByName=321;Source: Sort by name
cm_SrcByExt=322;Source: Sort by extension
cm_SrcBySize=323;Source: Sort by size
cm_SrcByDateTime=324;Source: Sort by date
cm_SrcUnsorted=325;Source: Unsorted
cm_SrcNegOrder=330;Source: Reversed order


- - -


How to create an button

Right click on the button bar at the top and select "Change..."

In the "Change button bar" dialog, click "Add", then fill in the properties as follows:

Command = cm_SrcByDateTime,cm_GoToFirstFile,cm_SrcByName
Parameters = <empty>
Start path = <empty>
Icon file = WCMICONS.DLL
Tooltip =

Code: Select all

Command    = <your application with full or relative path, or a TC EM_ or CM_ command>
Parameters = <parameters for your application, e.g. TCs parameter (press F1 key for help)>
Start path = <if need, or leave empty>
Icon file  = <e.g.: WCMICONS.DLL>
Tooltip    = <a hint for you, so you still know next week what this button will do>
Enable "[_]Run minimized" or Run maximized, if wanted
Then click OK to create the button.


Note:
you do not need to take care on and fill out all fields.
"Command" is mandatory, "Icon" too, else the button is not visible. "Parameters" only if need.

While button is open for modification, press F1-key for more help.

Picture: https://image.ibb.co/e9H36J/Buttonbar_Change_Eng.png

Read more at: viewtopic.php?p=287965#287965


- - -


Exchangeable Button-Code:

Code: Select all

TOTALCMD#BAR#DATA
cm_SrcByDateTime,cm_GoToFirstFile,cm_SrcByName

WCMICONS.DLL,5
Select newest file


-1
-or-

Exchangeable Button-Code:

Code: Select all

TOTALCMD#BAR#DATA
cm_SrcByDateTime,cm_SrcNegOrder,cm_GoToFirstFile,cm_SrcByName

WCMICONS.DLL,7
Select OLDEST file


-1
How to use: mark that code, copy to clipboard, next right click on TCs Button bar and choose 'Paste'
(Read more about at > https://www.ghisler.ch/board/viewtopic.php?p=335879#335879)




 

Posted: 2018-05-17, 14:27 UTC
by MVV
What if files are already sorted by date? Also it will be very slow in large dirs. It would be much faster to detect most recent item with a script and call TOTALCMD /o /S /L="path".

Posted: 2018-05-17, 15:55 UTC
by Horst.Epp
I use the following Button which always go to the newest file
in the active side, regardless of sorting.

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

Posted: 2018-05-17, 16:02 UTC
by dragonetti
@Horst.Epp , Stefan2 and MVV

Wow!

Thank you all, this contains very useful information!!!
I solved the 'put cursor on newest file' issue and used this to solve other issues!

Thank you!

MS-DOS: Select newest youngest oldest file

Posted: 2018-05-18, 08:08 UTC
by Stefan2
MVV wrote:.
Right, I wanted to write a script myself, but then thought internal commands may work good enough. But you made a valid point there.

Horst.Epp wrote:.

Nice, well done, I will use that too.
For other readers: to select the oldest file use "/od" instead of "/o-d".
(In a black DOS-Box type "dir /?" and press enter to read more about)