Template support for "Create new file"

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
User avatar
funkymonk
Senior Member
Senior Member
Posts: 416
Joined: 2013-12-04, 09:56 UTC

Template support for "Create new file"

Post by *funkymonk »

With default TC settings in TC10.52rc4, SHIFT+F4
  1. opens a dialog that asks for a file name;
  2. if the file does not exist, an empty (0 byte) file with this name is created;
  3. the file is opened with the program that is associated to the file name extension.
This is fine for, e.g., text files. However, many applications cannot directly deal with empty files.

Example:
If you pass a 0 byte file with extension .docx to MS Word, Word opens the file without complaint. Upon save (Ctrl+S), it silently turns the file into a real .docx file with the corresponding header, etc.
If you try the same with .xlsx files, Excel will reject the empty .xlsx file.

My suggestion ist to have template support for "Create new file" (Shift+F4):
  1. opens a dialog that asks for a file name (--> as before);
  2. if the file does not exist, a new file with this name is created;

    NEW: Depending on the extension, a default template file will be copied – OR – a template can be selected from a dropdown list.
    E.g., for “test.xlsx” a (default) Excel template file will be copied to test.xlsx in the current folder.
    To support several templates for the same extension, a dropdown list could provide the options.
  3. the file is opened with the program that is associated to the file name extension. (--> as before)
Of course, docx/xlsx are just examples.
Even though it means some implementation work for the TC author to provide template configuration, I would consider is this feature very useful.

((
Yes, one could create button that copies a template file and then rename and edit it manually.
And also yes, an AHK script could be used.
Actually, I would consider is this feature very useful when directly implemented in TC.
))
hi5
Power Member
Power Member
Posts: 551
Joined: 2012-11-03, 11:35 UTC
Contact:

Re: Template support for "Create new file"

Post by *hi5 »

F4MiniMenu (Forum) - Open selected file(s) from TC in defined editor(s) - A (minimalistic) clone of F4Menu
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48075
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Template support for "Create new file"

Post by *ghisler(Author) »

Shift+F4 doesn't open the empty file with the associated program. It always opens it with the text editor configured for F4. It is really only meant for text files. For other file types, use the right click context menu of the directory. It has a "New" sub-menu which uses the registry entries for new file creation. This can also use templates from the templates folder, or from registry keys, or even open a special Windows dialog (e.g. for new .lnk file).
Author of Total Commander
https://www.ghisler.com
User avatar
petermad
Power Member
Power Member
Posts: 14791
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Template support for "Create new file"

Post by *petermad »

use the right click context menu of the directory. It has a "New" sub-menu which uses the registry entries for new file creation.
This can also be opened with the cm_EditFileMenu command.
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
User avatar
funkymonk
Senior Member
Senior Member
Posts: 416
Joined: 2013-12-04, 09:56 UTC

Re: Template support for "Create new file"

Post by *funkymonk »

ghisler(Author) wrote: 2022-10-19, 07:56 UTC Shift+F4 doesn't open the empty file with the associated program. It always opens it with the text editor configured for F4.
Yes, right. As I am using OpenFileTC as default editor, I got the impression that TC calls the associated program -- but it's OpenFileTC.
Sorry.

Since I don't find the New Menu (cm_EditFileMenu) very helpful for a portable TC, I will find another solution...
User avatar
petermad
Power Member
Power Member
Posts: 14791
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Template support for "Create new file"

Post by *petermad »

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
User avatar
funkymonk
Senior Member
Senior Member
Posts: 416
Joined: 2013-12-04, 09:56 UTC

Re: Template support for "Create new file"

Post by *funkymonk »

petermad wrote: 2022-10-19, 15:26 UTC F4Menu works fine for me: http://totalcmd.net/plugring/F4Menu.html
Thank you. I'll give it a try. :)
Post Reply