New parameter '%Selected' for repeated command execution

Here you can propose new features, make suggestions etc.

Moderators: Hacker, petermad, Stefan2, white

Post Reply
User avatar
CopyCats
Member
Member
Posts: 195
Joined: 2003-02-05, 13:09 UTC
Location: Netherlands
Contact:

New parameter '%Selected' for repeated command execution

Post by *CopyCats »

I'd like to see a new magic parameter "%Selected" that can be used in the command line box (and possibly in button definitions?).

It would stand for "each file that is currently selected".

The magic is that when Total Commander sees this parameter in a command, it will automatically repeat that command for each file that is currently selected! :D

For example, if I have selected 5 files, and I type in the command line box: "Notepad %Selected", then Total Commander will pass this batch of commands to the OS:

[face=courier]Notepad <selected_file_1>
Notepad <selected_file_2>
Notepad <selected_file_3>
Notepad <selected_file_4>
Notepad <selected_file_5>
[/face]

Additional related new parameters could be:
%SelectedStop%, where each command must complete and exit before the next is started;
%SelectedPath%, where not just the filename but its full path is passed, and
%SelectedPathStop% which combines the above.

(in the logfile, each commandline that was executed would have to be recorded individually, so you can check what you did wrong when things go awry :lol:)

Of course, the actual name of this new parameter doesn't matter; '%X' would be just fine too.

P.S. a different but related idea: it would be nice if we could somehow use the button bar parameters (%N, %S, etc) in the command line box too. The benefit would be that you could repeat such commands for different files without having to edit the command line at all.
#5050 :: Everyone who believes in telekinesis, raise my hand!
User avatar
sqa_wizard
Power Member
Power Member
Posts: 3896
Joined: 2003-02-06, 11:41 UTC
Location: Germany

Post by *sqa_wizard »

... it will automatically repeat that command for each file that is currently selected!
Try List to MultiInstance (a TC utility) for this purpose.
#5767 Personal license
User avatar
Hacker
Moderator
Moderator
Posts: 13144
Joined: 2003-02-06, 14:56 UTC
Location: Bratislava, Slovakia

Post by *Hacker »

CopyCats,
Or use RunOnAllCores.ahk.

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
CopyCats
Member
Member
Posts: 195
Joined: 2003-02-05, 13:09 UTC
Location: Netherlands
Contact:

Post by *CopyCats »

Thanks guys, but I suggested it because I feel that TC should have this functionality built-in.
#5050 :: Everyone who believes in telekinesis, raise my hand!
User avatar
Balderstrom
Power Member
Power Member
Posts: 2148
Joined: 2005-10-11, 10:10 UTC

Post by *Balderstrom »

TC already can do this, with %UL, %L, or %WL

The problems are:
1) TC doesn't have consistent quoting mechanism and doesn't allow one to force quoting around file names.
2) Batch files don't handle UTF-16 Files at all.
3) Batch files don't handle UTF-8 Files that have various unicode characters in file names.

One could possibly use PowerShell, but most TC users are more familiar with batch (cmd).

If your files don't have UTF/Unicode characters then a command button:
Command: cmd.exe /k tcRunFile.cmd
Parameters: notepad.exe %L

Code: Select all

FOR /F "usebackq delims=" %%F IN ("%~2") DO CALL:RunFile "%~1" "%%~F"
GOTO:EOF
:RunFile
START "" %1 %2
Personally, I just use AHK for most intents and purposes. The batch command line is not dependable enough.

You'll likely find suggestions for "features" that already have a plugin/workaround wont be implemented.

Search the board for "built in" or "built-in", lots of suggestions by users that feel that feature-x should be native/built-in that already has a workaround/script or plugin.

Granted I find it amusing that so many users refuse to use the provided workaround/script when people attempt to help. And instead just go without it entirely.
*BLINK* TC9 Added WM_COPYDATA and WM_USER queries for scripting.
User avatar
buzzlightyear
Junior Member
Junior Member
Posts: 42
Joined: 2004-10-01, 10:46 UTC

Post by *buzzlightyear »

Balderstrom wrote:Granted I find it amusing that so many users refuse to use the provided workaround/script when people attempt to help. And instead just go without it entirely.
Perhaps because Win32 console apps, including scripts, open a black console window which closes immediately (leaving the average user with the impression something has gone wrong or something that they cannot control was going on) or simply look alienating for the non-professional user?

Have you noticed how many shareware apps are being offered (and bought!) that do nothing else than wrapping existing command line apps with a GUI? Example: Just try to count the numerous utilities that translate ip addresses to names or vice versa LOL

IMO a better approach is to use external apps that run in the Win32 subsystem. For example, use 7zg.exe instead of 7z.exe.
Or use tools like run.exe that completely hide the console window.
Post Reply