F4 - how to edit multiple selected files?

English support forum

Moderators: Hacker, petermad, Stefan2, white

KozakMak
Senior Member
Senior Member
Posts: 486
Joined: 2021-05-24, 12:39 UTC
Location: UA

F4 - how to edit multiple selected files?

Post by *KozakMak »

"%commander_path%\Utils\Notepad++\notepad++.exe" "%S"
is that how it should work (in Configuration - Edit/View section)?
OS: Win10 | TC: latest x64
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: F4 - edit multiple selected files?

Post by *Stefan2 »

No.

F4 always opens one file only.

Flint wrote: 2004-12-13, 13:13 UTC mds211
Try to use Choice Editor:
http://www.totalcmd.net/plugring/ChoiceEditor.html
It allows assigning different editors for different extensions for opening by F4, setting multiple editors for the same extension and opening all the selected files at once.

There are other tools to extend F4 too, I will try to post them here too once I remember them all...

Also there a plugins like List2Multi and such, we already have collected them all, I just have to find the post again.


 
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: F4 - edit multiple selected files?

Post by *Stefan2 »

 
Alternative tools for the "F4-command" in Configuration:

It allows assigning different editors for different extensions for opening by F4,
setting multiple editors for the same extension
and opening all the selected files at once (multiple tabs in one editor or multiple editors, depends on used editor and settings on that editor)


- F4MiniMenu, http://ghisler.ch/board/viewtopic.php?t=35721
- ChoiceEditor, http://www.totalcmd.net/plugring/ChoiceEditor.html
- Open File shell for TC, http://www.totalcmd.net/plugring/OpenFileTC.html
- Total Commander Edit Redirector, http://ghisler.ch/board/viewtopic.php?t=27573
- F4Menu, http://ghisler.ch/board/viewtopic.php?t=17003



 
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: F4 - edit multiple selected files?

Post by *Stefan2 »

a short list of related plugins:


List To MultiInstance aka L2M
http://totalcmd.net/plugring/listm.html
Copyright (c) 1999-2001 by Andrey V. Sorokin
l2m.exe /L:<List file> [/X:<Execute program>] [/B:<before param>] [/E:<end param>] [/W] [/S] [/P] [/F:<pause>] [/G:<gui mode>] [/R:<RegExp>] [/I] /J:<project>] [/M:<window_mode>] [/O:<priority>]
or
l2m.exe <filename>


List2Run\
http://ghisler.ch/board/viewtopic.php?t=3418
lst2run [-h] [-e [exe]] [-s [expression]] [-l [list.file]] [-w [ms.]][-p [ms.]] [-b]


lst2str\
http://www.ghisler.com/dtools.htm
lst2str /X:[program.exe] /L:[listfile] /F:[file] /N:[nnn] /W:[state] /C:[nnn] /S:[switches]
C:\wincmd\lst2str.exe /X:"C:\Program Files\ExamDiff Pro\ExamDiff.exe" /L:%L /F:%T%M /N:2
"%COMMANDER_PATH%\Tools\L2S\Lst2str.exe" /x:Path\to\textpad.exe /l:%L


lst2clip\ (List To Clipboard)
Copyright (C) 2003 Lefteous
https://ghisler.ch/board/viewtopic.php?f=6&t=1853
Ergänzung zu den internen Kommandos wie zB cm_CopyFullNamesToClip. Man kann genau festlegen wie die Pfade kopiert werden.
"%COMMANDER_PATH%\Tools\Lst2Clip\Lst2Clip.exe" /R:"ftp:"="http:" /L:"%P"

lst2clip-u\
About the same as Lst2Clip, only with unicode support, long paths and with some inconsequential little things





additions and corrections welcome



 
KozakMak
Senior Member
Senior Member
Posts: 486
Joined: 2021-05-24, 12:39 UTC
Location: UA

Re: F4 - edit multiple selected files?

Post by *KozakMak »

and without third party software?
maybe em_ command?
OS: Win10 | TC: latest x64
User avatar
Gral
Power Member
Power Member
Posts: 1600
Joined: 2005-01-26, 15:12 UTC

Re: F4 - edit multiple selected files?

Post by *Gral »

Of course - you can assign such a command to ANY key!
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: F4 - edit multiple selected files?

Post by *Stefan2 »

KozakMak wrote: 2023-07-27, 08:29 UTC and without third party software?
maybe em_ command?
Yes, possible too.

- select all files
- run a script (JS, VBS, AHK, PoSh, Batch, called via button or shortcut) and pass TC-parameter like "%L" (contains all selected files, one by line)
- the script should loop over the temp file (created by the %L-option) and call your editor for each line of that temp file




 
User avatar
petermad
Power Member
Power Member
Posts: 16030
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: F4 - edit multiple selected files?

Post by *petermad »

KozakMak wrote: 2023-07-27, 08:29 UTC and without third party software?
maybe em_ command?
usercmd.ini:

Code: Select all

[em_notepadplus]
cmd=%commander_path%\Utils\Notepad++\notepad++.exe
param=%P%S
Then you can assign em_notepadplus to F4

wincmd.ini

Code: Select all

[Shortcuts]
F4=em_notepadplus
Last edited by petermad on 2023-07-27, 12:18 UTC, edited 2 times in total.
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
Pawel
Junior Member
Junior Member
Posts: 91
Joined: 2018-12-18, 11:54 UTC
Location: Poland
Contact:

Re: F4 - edit multiple selected files?

Post by *Pawel »

I discussed about it with Christian. As far as I know it will be not implemented natively.
But, it can be done using external tools (or by setting a custom shortcut).

I implemented such functionality in my Ultimate File Manager project. It will be however available in next release (UFM 11 - when TC 11 will be released).
Thanks to UFM Shell Manager, you can assign application to chosen extensions (file types). Both for F3 (Open Action) and F4 (Edit Action).
You don't have to set custom shortuct fot TC using defined custom command (like @petermad showed).

Example:
https://www.dropbox.com/scl/fi/0u86b8qs9aipjyvu1jyf3/F3F4.mp4?rlkey=emejq5tph7uwagn3ankvjzic9&dl=0

UFM: https://pawelporwisz.pl/ufm/ufm.php

-Pawel
JOUBE
Power Member
Power Member
Posts: 1664
Joined: 2004-07-08, 08:58 UTC

Re: F4 - edit multiple selected files?

Post by *JOUBE »

petermad wrote: 2023-07-27, 10:05 UTC usercmd.ini:

Code: Select all

[em_notepadplus]
cmd=%commander_path%\Utils\Notepad++\notepad++.exe
param=%S
wincmd.ini

Code: Select all

[Shortcuts]
F4=em_notepadplus
This is the nearly complete right answer. Use: param=%P%S

Joube

If using Notepad++ (at that path: %commander_path%\Utils\Notepad++\notepad++.exe) ;-)
User avatar
petermad
Power Member
Power Member
Posts: 16030
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: F4 - edit multiple selected files?

Post by *petermad »

2JOUBE
This is the nearly complete right answer. Use: param=%P%S
I had that at first - but then I tested it and it works without %P (for notepad++), and since there is a limit of about 1018 characters to the parameter field, using only %S saves a lot of characters - so you can select more files without %P.

Notice that TC always sets the current path (if path= is not defined for the em_command), and apparantly that is enough for notepad++ to accept filenames without path.
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
User avatar
Stefan2
Power Member
Power Member
Posts: 4281
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: F4 - edit multiple selected files?

Post by *Stefan2 »

petermad wrote: 2023-07-27, 10:05 UTC
KozakMak wrote: 2023-07-27, 08:29 UTC and without third party software?
maybe em_ command?
usercmd.ini:

Code: Select all

[em_notepadplus]
cmd=%commander_path%\Utils\Notepad++\notepad++.exe
param=%S
Then you can assign em_notepadplus to F4

wincmd.ini

Code: Select all

[Shortcuts]
F4=em_notepadplus

Thanks for helping out petermad.

My suggestions:

Always add quotes (as Dalai says):

Code: Select all

[em_notepadplus]
cmd="%commander_path%\Utils\Notepad++\notepad++.exe"
param=%S
And:
Then you can assign em_notepadplus for example to F4 or any other key, e.g. Alt+F4 (overwriting Exit, close program) or use this em_command as command in a button.






 
JOUBE
Power Member
Power Member
Posts: 1664
Joined: 2004-07-08, 08:58 UTC

Re: F4 - edit multiple selected files?

Post by *JOUBE »

petermad wrote: 2023-07-27, 10:49 UTC 2JOUBE
This is the nearly complete right answer. Use: param=%P%S
I had that at first - but then I tested it and it works without %P (for notepad++), and since there is a limit of about 1018 characters to the parameter field, using only %S saves a lot of characters - so you can select more files without %P.

Notice that TC always sets the current path (if path= is not defined for the em_command), and apparantly that is enough for notepad++ to accept filenames without path.
If you use it with files from different folders (e.g. Find files -> Feed to listbox) the better solution is param=%P%S. So use it in every cases. (acording help: commad line: 32767 chars)
User avatar
petermad
Power Member
Power Member
Posts: 16030
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: F4 - edit multiple selected files?

Post by *petermad »

If you use it with files from different folders (e.g. Find files -> Feed to listbox) the better solution is param=%P%S
You got a point there.

acording help: commad line: 32767 char
It depends on the command, for the cd command it is only around 1020 ( https://ghisler.ch/board/viewtopic.php?t=54497 )

But I checked with notepad++.exe - there is no such low limit - I guess the limit for external programs is the 32767 that is the limit for %S.

I have reinserted %P in my previous post about the em_command.


Stefan2 wrote:Always add quotes (as Dalai says):
Quotes are not mandatory for program names in the Command field even if the paths contains spaces - but the quotes doesn't harm.
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
User avatar
white
Power Member
Power Member
Posts: 5789
Joined: 2003-11-19, 08:16 UTC
Location: Netherlands

Re: F4 - edit multiple selected files?

Post by *white »

petermad wrote: 2023-07-27, 12:18 UTC
Stefan2 wrote:Always add quotes (as Dalai says):
Quotes are not mandatory for program names in the Command field even if the paths contains spaces - but the quotes doesn't harm.
In fact, adding quotes to the ini as shown by Stefan2 doesn't do anything, does it?
Post Reply