What are the benefits of User-defined Commands (UDC)?

English support forum

Moderators: white, Hacker, petermad, Stefan2

Post Reply
risk
Junior Member
Junior Member
Posts: 85
Joined: 2007-07-30, 03:18 UTC

What are the benefits of User-defined Commands (UDC)?

Post by *risk »

I just checked my usercmd.ini file and saw a couple of commands that I created years ago but forgot about them. Could someone refresh my memory of the benefits of UDC? I mean, why use UDC over bar buttons that do the same thing or call batch of AHK files?

Thank you.
User avatar
Stefan2
Power Member
Power Member
Posts: 4158
Joined: 2007-09-13, 22:20 UTC
Location: Europa

Re: What are the benefits of User-defined Commands (UDC)?

Post by *Stefan2 »

You can do with an UDC (User-defined Command, created in usercmd.ini) the same things
you can do with an button (executing an command, cd to folder, open document, run script,..),
but with UDC you have more flexibility and freedom to do more advanced things with that commands.
The advantage of an button is that he is more quicker created, with less steps and less clicks,
and he was the first existing possibility to execute things.

Me think the main advantage of an UDC is that you can assign an keyboard shortcut to execute that command.

The UDC "em_name" can also be used as command in an button and also just typed in the TC command line.

Apart form the Button bar and Keyboard shortcuts, you can also use em_commands in the Start menu,
the Main menu, in Alias'es and in the Directory hotlist (Ctrl+D) - so em_commands are very versatile. (by petermad 2012)


Also you have more place to create your command as you work in notepad, in contrast to work in the small/narrow button dialog.
Maybe including copy&paste templates and things like spellchecker (depending on the used Notepad).

Edit based on tuskas' objection: You can combine several UDCs by executing them all in one step, and also still separately each on its own:
[em_Test1] ;Execute several commands as an test
cmd=em_Test2,em_Test3
[eM_Test2]
cmd=cm_About
[EM_Test3]
cmd=cm_HelpIndex
Now execute em_Test1, to get em_Test2 and 3 executed in the same step too. Also you can still run em_Test3 alown.


You can execute UDC "em_name" by an Alias command (like you can with internal cm_commands too, but you can't execute an button by an Alias):
[Alias]
doit=em_Test1_with_longer_Name
Type 'doit' in TC command line to execute the UDC with the Name "em_Test1_with_longer_Name"

Next you can use Alias commands placeholder %A (or %A1...%A9), to modify the command on the fly, in UDC only, AFAIK?
Hope I am not wrong,... corrections please.
 
User avatar
tuska
Power Member
Power Member
Posts: 3760
Joined: 2007-05-21, 12:17 UTC

Re: What are the benefits of User-defined Commands (UDC)?

Post by *tuska »

Apart from the already mentioned possibilities I see a big advantage in using combined em_commands.

For example (Button):

Code: Select all

Command: em_%COMMANDER_PATH%,em_Filter-BAR-Files_Only,cm_ExchangeSelBoth,em_7z_left-or-right_BAR,cm_FocusTrg,em_WAIT,cm_GoToFirstFile,cm_FocusTrg,em_RemoveAllFilters,cm_SrcViewMode0,cm_FocusTrg
Tooltip: Create file "BAR.7z" in the opposite window|File properties are preserved during unpacking
User avatar
Gral
Power Member
Power Member
Posts: 1467
Joined: 2005-01-26, 15:12 UTC

Re: What are the benefits of User-defined Commands (UDC)?

Post by *Gral »

IMO, the most important is the possibility to add commands to the main menu.
Earlier it was possible only by linking to startmenu entry.
User avatar
petermad
Power Member
Power Member
Posts: 14808
Joined: 2003-02-05, 20:24 UTC
Location: Denmark
Contact:

Re: What are the benefits of User-defined Commands (UDC)?

Post by *petermad »

2risk
Yiu can see user-defined commands heavily exploited in my Extended Menus, with up to 546 em_commands (Windows 10 version).

In my menus the user commands are stored in wcmd_*.ini files that correspond the wcmd_*.mnu file - keeping the usercmd.ini file untouched.
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
Post Reply