Create multiple files at once

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

User avatar
Hacker
Moderator
Moderator
Posts: 13067
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Re: Create multiple files at once

Post by *Hacker »

Christian,
OK, then can we at least get the following?
Shift-F4, enter "|file1.txt|file2.txt", press Enter - to create those two files without opening them in an editor? Basically, a pipe prefix would instruct TC not to open the editor for the given (pipe-separated) files.

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.
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3299
Joined: 2003-05-06, 11:46 UTC

Re: Create multiple files at once

Post by *Sir_SiLvA »

Hacker wrote: 2023-06-27, 11:37 UTC Christian,
OK, then can we at least get the following?
Shift-F4, enter "|file1.txt|file2.txt", press Enter - to create those two files without opening them in an editor? Basically, a pipe prefix would instruct TC not to open the editor for the given (pipe-separated) files.
Support ++
(imho "file1.txt|file2.txt" alone should instruct tc to create multiple files without opening them)
Hoecker sie sind raus!
monarch-lfv
Junior Member
Junior Member
Posts: 73
Joined: 2022-06-16, 23:37 UTC

Re: Create multiple files at once

Post by *monarch-lfv »

This does not cancel the suggestion in the topic, but it may come in handy, the script on VBS:

Code: Select all

' Creation of empty files separated by a sign '|'
' with the replacement of prohibited characters with "_" 
' and removal of spaces at the beginning and at the end  

' Parameters: %P
'======================================================================
On Error Resume Next
Dim FSO, Fn, Sym, i, F, f1
Set FSO = CreateObject("Scripting.FileSystemObject")
Fn=Inputbox("File names separated by a sign '|'", "Create files", "File 1.txt|File 2.ext | ""fil.?x*""")
Sym = "/\*?"
For Each F In Split(Fn, "|")
  F=Replace(F, """", "")
  For i = 1 To Len(Sym)
    F = Replace(F, Mid(Sym, i, 1), "_")
  Next
  Set f1 = FSO.CreateTextFile(WScript.Arguments(0) & Trim(F), False)
Next
User avatar
Hacker
Moderator
Moderator
Posts: 13067
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Re: Create multiple files at once

Post by *Hacker »

Sir_SiLvA,
imho "file1.txt|file2.txt" alone should instruct tc to create multiple files without opening them
file1.txt|file2.txt could simply open two editor windows with those files. I wanted to keep that reserved for such use in the future perhaps.

Christian,
Thank you very much for adding this in TC11b9! 8)
Any chance we could change the syntax to:

Code: Select all

|file1.txt|file2.txt
(with first symbol pipe) simply creates the two files, and

Code: Select all

file1.txt|file2.txt
(without first symbol pipe) creates the files and opens the editor for each of them (that would be a future suggestion, but the syntax would work).

TIA
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.
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3299
Joined: 2003-05-06, 11:46 UTC

Re: Create multiple files at once

Post by *Sir_SiLvA »

Hacker wrote: 2023-06-28, 17:39 UTC I wanted to keep that reserved for such use in the future perhaps.
I prefer some consistency so that what works in the New Dir Dialog works the exact same in the New File Dialog ... 8)

@Chris: Thanks for adding this :!:
Hoecker sie sind raus!
User avatar
Hacker
Moderator
Moderator
Posts: 13067
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Re: Create multiple files at once

Post by *Hacker »

Sir_SiLvA,
I prefer some consistency
Which in this case prevents the implementation of a useful feature. Perhaps you have some alternative implementation idea?

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.
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3299
Joined: 2003-05-06, 11:46 UTC

Re: Create multiple files at once

Post by *Sir_SiLvA »

Hacker wrote: 2023-06-28, 18:41 UTC Which in this case prevents the implementation of a useful feature. Perhaps you have some alternative implementation idea?
Yes I would put your | at the end followed by a > to tell tc to start the created files
(1st check for internal associations ofc, 2nd if none are found let windows sort it out 8))
which would open the possibility to even do something crazy (which will hence never be implemted by Chris :))
like file1.txt|file1.jpg|file2.jpg|file2.txt|readme.rtf|>2-3(some jpg editor),5(some text writting app)
which would tell tc to 1st create file1.txt, file1.jpg, file2.jpg, file2.txt & readme.rtf and then run the jpgs with "some jpg editor".
My point is that by putting your pipe at the end you are open to do more usefull stuff without being incosistence
if you get my drift :?:

(I hope this translated at all into english and yes I am aware that a syntax with () and , is not the best choice as
both can be part of filename but it was just an example)
Hoecker sie sind raus!
User avatar
Hacker
Moderator
Moderator
Posts: 13067
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Re: Create multiple files at once

Post by *Hacker »

Sir_SiLvA,
Well, I get your idea, but I am not sure if there is any non-text editor out there which can open an empty file and treat it as a valid one (jpg / bmp / rtf / html / docx / mp3 / etc.etc.).

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.
User avatar
Sir_SiLvA
Power Member
Power Member
Posts: 3299
Joined: 2003-05-06, 11:46 UTC

Re: Create multiple files at once

Post by *Sir_SiLvA »

Hacker wrote: 2023-06-28, 19:47 UTC Sir_SiLvA,
Well, I get your idea, but I am not sure if there is any non-text editor out there which can open an empty file and treat it as a valid one (jpg / bmp / rtf / html / docx / mp3 / etc.etc.).
I know :-/ but at least something like
file1.txt|file2.txt|file3.txt|file4.html|readme.rtf|>1-3(some_path\NoteTab.exe),4(some_path\notepad++.exe),5(wordpad.exe)
would work (with only 3 shellex calls instead of 5 :-)) :D

otherwise lets add at least |> for hackers suggestion :!:
Hoecker sie sind raus!
User avatar
Hacker
Moderator
Moderator
Posts: 13067
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Re: Create multiple files at once

Post by *Hacker »

Sir_SiLvA,
file1.txt|file2.txt|file3.txt|file4.html|readme.rtf|>1-3(some_path\NoteTab.exe),4(some_path\notepad++.exe),5(wordpad.exe)
Is that a realistic scenario? Open five empty new text files in three different editors?
lets add at least |> for hackers suggestion
Thanks.

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.
Fla$her
Power Member
Power Member
Posts: 2318
Joined: 2020-01-18, 04:03 UTC

Re: Create multiple files at once

Post by *Fla$her »

ghisler(Author) wrote: 2023-06-27, 10:59 UTC Unfortunately this would not work well together with parameter 1. Numeric parameters can be passed as LPARAM directly to the internal function, text parameters can't. It would break scripts calling cm_EditNewFile with parameter 1.
In this case, you can add cm_CreateNewFile in which multi-mode will be supported.
Overquoting is evil! 👎
User avatar
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Create multiple files at once

Post by *ghisler(Author) »

In beta 10, I have added parameters to cm_Edit instead of cm_EditNewFile. It allows to just open, just create, or create and open files. It allows to open them either with the configured editor, or with an associated program (with or without internal associations). Please let me know what you think! The options are (from the help):

The following parameters can be passed to the function behind a slash:
C: Create files which do not already exit
T: Instead of creating an empty file, copy a template file to the new name. By default, the user's template directory will be used. The first file in it with the same extension will be copied to the new file. If no file is found, an empty file will be created
T="c:\path": Sames as T but use the specified template directory
N="name": The name(s) of the file(s) to be created
G: Go, create new files immediately (has no effect when not using C)
L: Launch type: L0=do not launch, L1=open with default editor, L2=open with associated program (including internal associations), L3=open with associated program (no internal associations)
V="verb": Combined with L2 or L3, set the verb to open the file, e.g. "open" or "edit". Leave out for default verb.
Author of Total Commander
https://www.ghisler.com
hi5
Power Member
Power Member
Posts: 551
Joined: 2012-11-03, 11:35 UTC
Contact:

Re: Create multiple files at once

Post by *hi5 »

Typo: Create files which do not already exit -> exist
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
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: Create multiple files at once

Post by *petermad »

By default, the user's template directory will be used
Where will that typically be? I have 2 templates directories in my Windows user profile:
"%AppData%\Roaming\Microsoft\Templates"
"%AppData%\Roaming\Microsoft\Windows\Templates"

They are both empty - which of the two will TC use - if any?

EDIT: I figured out that TC uses "%AppData%\Roaming\Microsoft\Windows\Templates"

There is a bug when trying to use the parameters in the Command field of a button - see: https://ghisler.ch/board/viewtopic.php?t=79523

I suggest to change the help text a little:
N="name": The name(s) of the file(s) to be created
to
N="name": The name(s) of the file(s) to be created - separate multiple file names with the | character
Otherwise only people who has read this topic will know to use | between multiple file names.
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
ghisler(Author)
Site Admin
Site Admin
Posts: 48088
Joined: 2003-02-04, 09:46 UTC
Location: Switzerland
Contact:

Re: Create multiple files at once

Post by *ghisler(Author) »

TC uses %$Templates%, you can go there via command line:
cd %$Templates%
Otherwise only people who has read this topic will know to use | between multiple file names.
Agreed, although it's not the only way, you can also use a counter as in the regular Shift+F4 dialog box.
Author of Total Commander
https://www.ghisler.com
Post Reply