Keyboard shortcut for inserting date when editing file names

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

TvE
Junior Member
Junior Member
Posts: 8
Joined: 2022-03-17, 22:53 UTC
Location: Denmark

Re: Keyboard shortcut for inserting date when editing file names

Post by *TvE »

Hmm... I see that there is an SHIFT+F4 shortcut which is calling this command:
cm_EditNewFile 2931 Create+Open new text file

I am not able to see [1] that this command can be called with other arguments than `1´ (which suppresses the edit).

So my question is if it's somehow possible to utilize `cm_EditNewFile´ to obtain my "create filename with current Date/DateTime prepended mapped to a keyboard shortcut?

My objective - just to make it perfectly clear - is to be able to use a keyboard shortcut to create a new txt file and open it for editing file with the current Date/DateTime prepended to the filename.

My above two comments show what I have achieved so far - which is >95% of what I want, BUT as I am now exploring the great options(!) for extending TCM with custom functionality I am getting greedy and want to do more :D

If I can get the `cm_EditNewFile´ to help me I can optimize my workflow from two steps to one (50% improvement), for an action that is in the top 10 of my TCM interaction :P

[1] https://www.ghisler.ch/wiki/index.php?title=List_of_internal_commands
User avatar
petermad
Power Member
Power Member
Posts: 14809
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Keyboard shortcut for inserting date when editing file names

Post by *petermad »

2TvE
You can not do what you wish for with cm_EditNewFile, but you can do it with cm_Edit.

Go to the Misc section of the Configuration dialog and remap Shift+F4 to either of these two setings:

https://tcmd.madsenworld.dk/editnewfilewdate1.png
or
https://tcmd.madsenworld.dk/editnewfilewdate2.png

Remember to click the green check mark

Or go to the [Shortcuts] section of your wincmd.ini file ( cd %COMMANDER_INI% ) and add these lines:

Code: Select all

S+F4=cm_Edit
S+F4_params=/CN="<[Y]-[M]-[D]_[h].[m].[s]_[N].[E]"
or these:

Code: Select all

S+F4=cm_Edit
S+F4_params=/CN="%|$DATE:Y-M-D_h.m.s|_%Q%N"
You can of course choose to remap to other keys than Shift+F4, and you can change the order of Y, M and D to reflect your locale (D-M-Y for Danish)
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
sa16
Senior Member
Senior Member
Posts: 217
Joined: 2021-09-10, 07:15 UTC

Re: Keyboard shortcut for inserting date when editing file names

Post by *sa16 »

You can also add the key G:

Code: Select all

/GCN="<[Y]-[M]-[D]_[h].[m].[s]_%Q%N"
/GCN="%|$DATE:Y-M-D_h.m.s|_%Q%N"
TvE
Junior Member
Junior Member
Posts: 8
Joined: 2022-03-17, 22:53 UTC
Location: Denmark

Re: Keyboard shortcut for inserting date when editing file names

Post by *TvE »

2petermad PS.: Jeg har sendt dig en fin hilsen i din gæstebog her den anden dag
Tak for det danske tip, men jeg er mere til ISO-8601 format, så det bliver

Code: Select all

[Y]-[M]-[D]_[h][m][s]_[N].[E]
And now back to english :D

2sa16 Please enlighten me regarding `the G key´
I see that `%Q%N´ populates the dialog with the selected filename+extension - very usefull! - (but I was not able to find the documentation regarding these variables - which source have I missed?)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Keyboard shortcut for inserting date when editing file names

Post by *ghisler(Author) »

The parameters for cm_edit are described on the help page "Dialog box: Choose command".
You can get this page for example via
- right click on a button - change - click on magnifying glass symbol - F1
or
Type cm_commandbrowser in the command line - Enter - F1.
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14809
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Keyboard shortcut for inserting date when editing file names

Post by *petermad »

2TvE
Jeg så din hilsen i min Gæstebog - tak for det.

If you want to open that help page frequently, you can go directly to the page with this button:

Code: Select all

TOTALCMD#BAR#DATA
hh.exe %COMMANDER_PATH%\TOTALCMD.CHM::dlg_choosecommand.htm

C:\windows\hh.exe
Open Help for Choose Commands (cm_commands with parameters)

0
-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".

Documentation for parameters as for example %Q%N can be seen when you right-click on a button in the button bar and choose "Change" and then press F1

Direct link to Button bar help:

Code: Select all

TOTALCMD#BAR#DATA
hh.exe %COMMANDER_PATH%\TOTALCMD.CHM::dlg_configbuttonbar.htm

C:\windows\hh.exe
Open Help for Change buton bar

0
-1
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.50 on Android 6 & 13
Try: TC Extended Menus | TC Languagebar | TC Dark Help | PHSM-Calendar
sa16
Senior Member
Senior Member
Posts: 217
Joined: 2021-09-10, 07:15 UTC

Re: Keyboard shortcut for inserting date when editing file names

Post by *sa16 »

2TvE
In the TC11.03, you can already:

Code: Select all

/GCN="<[Y]-[M]-[D]_[h].[m].[s]_[A]"
TvE
Junior Member
Junior Member
Posts: 8
Joined: 2022-03-17, 22:53 UTC
Location: Denmark

Re: Keyboard shortcut for inserting date when editing file names

Post by *TvE »

Where are the MultiRenameTool's SavedSettings persisted in the configuration files?

In my_history.ini I can find
- the RenameMask (without the name I saved it with) in the [RenameTemplates] section
- the Name as well as the RenameMask in the [rename] section
BUT the latter does not map 1:1 to the settings I have saved (it both contain more listings as well as multiple versions of same setting, like a history list

Objective: How to manipulate config files to add predefined MultiFileRename settings...
User avatar
Dalai
Power Member
Power Member
Posts: 9393
Joined: 2005-01-28, 22:17 UTC
Location: Meiningen (Südthüringen)

Re: Keyboard shortcut for inserting date when editing file names

Post by *Dalai »

TvE wrote: 2024-02-25, 11:26 UTCWhere are the MultiRenameTool's SavedSettings persisted in the configuration files?
[...]
BUT the latter does not map 1:1 to the settings I have saved (it both contain more listings as well as multiple versions of same setting, like a history list
It's not a history list. The section [Rename] saves the rename profiles, each of them having a name, extension, search and replace, and parameters which are more or less a 1:1 mapping to the checkboxes like E, RegEx and so on.
Objective: How to manipulate config files to add predefined MultiFileRename settings...
Easy. Add them via the GUI and then copy the lines from wincmd.ini. One could write them from scratch but I'd do that only if I liked pain ;).

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