Create multiple files at once
Moderators: Hacker, petermad, Stefan2, white
Re: Create multiple files at once
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
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.
Re: Create multiple files at once
Support ++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.
(imho "file1.txt|file2.txt" alone should instruct tc to create multiple files without opening them)
Hoecker sie sind raus!
-
- Junior Member
- Posts: 79
- Joined: 2022-06-16, 23:37 UTC
Re: Create multiple files at once
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
Re: Create multiple files at once
Sir_SiLvA,
Christian,
Thank you very much for adding this in TC11b9!
Any chance we could change the syntax to:
(with first symbol pipe) simply creates the two files, and
(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
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.imho "file1.txt|file2.txt" alone should instruct tc to create multiple files without opening them
Christian,
Thank you very much for adding this in TC11b9!

Any chance we could change the syntax to:
Code: Select all
|file1.txt|file2.txt
Code: Select all
file1.txt|file2.txt
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.
Re: Create multiple files at once
I prefer some consistency so that what works in the New Dir Dialog works the exact same in the New File Dialog ...Hacker wrote: 2023-06-28, 17:39 UTC I wanted to keep that reserved for such use in the future perhaps.

@Chris: Thanks for adding this

Hoecker sie sind raus!
Re: Create multiple files at once
Sir_SiLvA,
Roman
Which in this case prevents the implementation of a useful feature. Perhaps you have some alternative implementation idea?I prefer some consistency
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: Create multiple files at once
Yes I would put your | at the end followed by a > to tell tc to start the created filesHacker 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?
(1st check for internal associations ofc, 2nd if none are found let windows sort it out

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!
Re: Create multiple files at once
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
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.
Re: Create multiple files at once
I know :-/ but at least something likeHacker 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.).
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


otherwise lets add at least |> for hackers suggestion

Hoecker sie sind raus!
Re: Create multiple files at once
Sir_SiLvA,
Roman
Is that a realistic scenario? Open five empty new text files in three different editors?file1.txt|file2.txt|file3.txt|file4.html|readme.rtf|>1-3(some_path\NoteTab.exe),4(some_path\notepad++.exe),5(wordpad.exe)
Thanks.lets add at least |> for hackers suggestion
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: Create multiple files at once
In this case, you can add cm_CreateNewFile in which multi-mode will be supported.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.
Overquoting is evil! 👎
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: Create multiple files at once
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.
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
https://www.ghisler.com
Re: Create multiple files at once
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)
Source at GitHub (AutoHotkey). TCSyncComments (copy file comments)
Re: Create multiple files at once
Where will that typically be? I have 2 templates directories in my Windows user profile:By default, the user's template directory will be used
"%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:
toN="name": The name(s) of the file(s) to be created
Otherwise only people who has read this topic will know to use | between multiple file names.N="name": The name(s) of the file(s) to be created - separate multiple file names with the | character
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
- ghisler(Author)
- Site Admin
- Posts: 50386
- Joined: 2003-02-04, 09:46 UTC
- Location: Switzerland
- Contact:
Re: Create multiple files at once
TC uses %$Templates%, you can go there via command line:
cd %$Templates%
cd %$Templates%
Agreed, although it's not the only way, you can also use a counter as in the regular Shift+F4 dialog box.Otherwise only people who has read this topic will know to use | between multiple file names.
Author of Total Commander
https://www.ghisler.com
https://www.ghisler.com