Macro Substitution (ALIAS to use Commands in TCs command line box)

Here you can propose new features, make suggestions etc.

Moderators: white, Hacker, petermad, Stefan2

Post Reply
aa_
Junior Member
Junior Member
Posts: 2
Joined: 2021-10-06, 22:00 UTC

Macro Substitution (ALIAS to use Commands in TCs command line box)

Post by *aa_ »

It would be great if TC has "Macro Substitution" that can be used in COMMAND LINE, like it does in Midnight Commander (mc), for instance, which I often used in mc:

%s: selected files, %d: directory
%S: selected files in OTHER PANEL, %D: directory in OTHER PANEL

I created a few custom button bar in TC with that kind of parameters (mostly just %T, %P and %S -- it's getting very complicated now), maybe just enabled some of them for COMMAND LINE as well?
User avatar
Stefan2
Power Member
Power Member
Posts: 4133
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: Macro Substitution

Post by *Stefan2 »

Hi and welcome.


See TOTALCMD.inc text file for internal commandos

example:
cm_SelectAllFiles=3302;Select all files


- - -


Under "Configuration > Options... > Misc." you can create an ALIAS for to use in TCs command line.

Alias: %s (or "ss")
Command: cm_SelectAllFiles
(use "magnifying glass" to search, and at the end also click the "check mark"-button)

Now type %s in TCs command line and press ENTER-key....


- - -


Alias: sf
Command: cm_SelectAllFolders


- - -


For "OTHER PANEL"

you can create a own user defined command
with "cm_FocusTrg=4006;Focus on target file list" (alternative for TAB-key)
in usercmd.ini like

[em_SelectAllFilesOnTarget]
cmd=cm_FocusTrg, cm_SelectAllFiles

and next use em_SelectAllFilesOnTarget as command for the alias.





or utilize
20.12.09 Added: SELECTFILES command supports modifiers (appended directly to command without space):
D=only folders, B=both, U=unselect, L=left side, R=right side, T=target panel,
S=Reverts whether just files or files+folders are selected when Shift is pressed during execution.
(see History.txt)


Fine is, SELECTFILES will just select and doesn't switch focus.


For to use that command with parameter
create an user defined command in usercmd.ini first:
[em_SelectFilesT]
cmd=selectFilesT *

or
cmd=selectFilesT *.txt

use em_SelectFilesT as command for the alias (or in an button).


Alias seams not to respect the case, so using %s and %S is no option.
I just added for me an additional "t": sst , sft


Use Ctr+E to reuse last command in TCs command line or to cycle through the last commands.
ALT+F8 or Ctrl+ArrowDown (maybe two times) Opens the history list of the command line
Or hold Ctrl-key, press E and next ArrowDown.
See Menu "Help > Keyboard" for more...



 
aa_
Junior Member
Junior Member
Posts: 2
Joined: 2021-10-06, 22:00 UTC

Re: Macro Substitution (ALIAS to use Commands in TCs command line box)

Post by *aa_ »

Thanks for your verbose reply, very appreciated; particularly I found ALT-F8 is quite handy rather than repeatedly pressing CTRL-E.

I admit I never been utilizing ALIAS in misc. section, but what I meant by %s %d etc. in my post above is in order to use them as ARGUMENT/PARAMETER in TC' command bar, not as COMMAND/EXECUTABLE. Just exactly as it does with custom button/command. With custom button I can feed the ARGUMENT %S, %D, %T etc. Why can't I used them directly in the TC's COMMAND BAR/COMMAND LINE?
Post Reply