FAQs: User-Defined Command (UDC) (usercmd.ini) em_command

English support forum

Moderators: sheep, Hacker, Stefan2, white

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

FAQs: User-Defined Command (UDC) (usercmd.ini) em_command

Post by *Stefan2 » 2018-07-24, 16:05 UTC

To create own user commands; use one of this two ways.



Way 1, manually by hand:

Just edit the file "usercmd.ini" in your TC directory.

Note 1: Usercmd.ini is always in the same directory as wincmd.ini (see Help menu > About TC > Paths)
Note 2: If you have no usercmd.ini there, create the file first as plain text file (ASCII or UNICODE)
(if you utilize the 'Way 2' below, that file will be created for by TC itself)


----------------------------- Example Entry 1

[em_MyCommandName]

cmd= <full or relative path to your executable>
(You can use the environment variables %commander_drive% or %commander_path%
to open programs independent from the drive letter of the USB stick.)

param= <parameters to your command, if any or a TC-internal parameter like %P %N %T %L %F %S .....>


----------------------------- Example Entry 2, add more settings if need/wanted

[em_MyCommandName]

cmd= <full or relative path to your executable>

param= <parameters to your command>

path= <empty, dot, or wanted folder as working directory>

menu= <like "tooltip=", add a tooltip if you want to use this em_command as command for an button>

button= <like "icon=", chose the icon if you want to use this em_command as command for an button>

iconic= < "=1" run minimized, else "=0" run normal mode and visible>


----------------------------- TIP:

(only the header and the cmd entry are need for a functional command. param is mostly used too to make any sense.
The others only if this user command should be used as menu button too, for to provide additional button settings)

Additional Tip: right click an existent button, and then press F1 key and read more.



----------------------------- Examples of working usercmd.ini entries:
totalcmd\usercmd.ini wrote:[em_hide_selected]
cmd=cd
param=*.*|%S
menu=Hide Selected Files
button=wcmicons.dll,73

[em_mydocuments]
cmd=cd %$PERSONAL%
menu=My Documents (personal)

[em_calc]
cmd=calc.exe


[em_newdir]
cmd=%COMSPEC% /c
param=if not exist "%T%O" md "%T%O"
menu=Make directory with same name as file under cursor in opposite panel
button=%COMMANDER_PATH%\wcmicons.dll,29

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

More information

petermad wrote:
petermad, Power Member
Posted: Sat Mar 22, 2014 1:29 Post subject: Meaning and use of "iconic" in Default.bar
Source URL: http://ghisler.ch/board/viewtopic.php?t=39951

iconic=1 is what you get when you check the option "Run minimized" in the "Change button bar" dialog.
iconic=-1 is what you get when you check the option "Run maximized".

If the button you are editing points to another button bar (a subbar) then iconic=1 means "Show as menu".

If iconic= is not present or just says iconic= then it means iconic=0.



Whether iconic=0 is present or not depends on how you started editing the button:

1. If you use the menu: "Configuration" -> "Button bar" and then find and edit the button in the "Change button bar" dialog then iconic=0 is set.
Same thing if you right click on the blank space in the end of the button bar and choose "Change".

2. If you on the other hand right click on an button in the bar and choose "Change" then the dialog "Change single button" opens,
and if you press OK in this dialog with "Run minimized" unchecked, then no iconic=0 is set and an existing iconic=0 for that button is removed.


Also if you copy and paste a button to the bar, then the items in the .bar file are mixed up and not written in sequence.
If you open the "Change button bar" dialog and press OK, then the items in the .bar file will be sorted correctly again and missing iconic=0 are added.

- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


Way 2, via dialog:

* open "Configuration > Options > Misc."
* choose any key (just temporarily for creating the command, or chose one to keep)
* click on magnifying glass icon, the 'cm_commandbrowser' will be launched
-or-
* just type 'cm_commandbrowser' into the TC command line box

-next-

* choose usercmd.ini at bottom of left listview
(the usercmd.ini file will be created if not existent yet, if you add a new command using new)

* click at [New]

* enter the wanted name for your new user defined command,
--- like for example 'em_MyCommandName'
--- (the "em_" -part is mandatory)
* click on OK

* type in your own command details,
or select a command on right side via the 'magnifying glass' symbol

* click on OK twice


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -


Add shortcut key to em_ or cm_ commands


Utilize "Configuration > Options > Misc." to assign the hot key.

* open "Configuration > Options > Misc."
* by "shortcuts" choose a free key combo
* click on the magnifying glass
* type em_ (or cm_) and choose the wanted command by double clicking on it
* close the options dialog with [OK]
* click on OK



You can also manipulate the wincmd.ini's "[Shortcuts]" directly,

Examples:

[Shortcuts]
;Enable 'F2'-key to start inline-rename mode, additional to origin 'Shift+F6'
F2=cm_RenameOnly
;Enable 'Ctrl+F' to start find-files, additional to origin 'Alt+F7'
C+F=cm_SearchFor
;Use 'Ctrl+O' to launch DOS-Box in current path
C+o=cm_ExecuteDOS
;Disable 'Alt+F4' (Exit, close program), load Help instead
A+F4=cm_Keyboard
;Ctrl+Shift+Alt+F5 erstelle Archive im selben Panel
CA+F5=cm_PackFiles
;Ctrl+Shift+Alt+F5 erstelle Archive im selben Panel und lösche Source
CAS+F5=cm_PackFiles
C+P=cm_CopyNamesToClip
CS+P=cm_CopyFullNamesToClip
AS+F4=em_ShellNewFileTemplates


- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Alternative usercmd.ini

petermad wrote:AFAIK it is not possible to redirect usercmd.ini (to another place than the folder of the wincmd.ini)

But if you use a menu file (not TC's internal English menu),
then you can also store user commands in a file with a name that corresponds the name of the menu file.

If for example your menu file is wcmd_arb.mnu then you can store user commands in a file named wcmd_arb.ini

If your menu file is wcmd_mytranslation_eng.mnu then you can store user commands in a file named wcmd_mytranslation_eng.ini etc.
- - -

Hint:
Extended English Menus for Total Commander (by petermad), is a alternative TC menu which contains almost every TC command (and some more)
Download it at: http://www.totalcmd.net/authors/1223914.html



- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -

Pitfalls:
- Some expanded TC parameter get automatically quoted, some not. Depends on if path contains space, and on parameter-combination sometimes.
- That parameter, which returns paths, have automatically an trailing backslash added.
-
-


- - -

FAQs: How to create an button
https://ghisler.ch/board/viewtopic.php?f=3&t=50632&p=344803

FAQs: Button-code: How-to Copy Share Paste a button ('TOTALCMD#BAR#DATA')
https://ghisler.ch/board/viewtopic.php?f=3&t=50633&p=335879

FAQs: User-Defined Command (UDC) (usercmd.ini) em_command
https://ghisler.ch/board/viewtopic.php?p=344777#p344777


- - -


 
Inofficial FAQs || WIKI (Deu/Eng) || TC Home (What's new? // FAQ // Download // Order // Addons // Tools // Plugins)
Erst wenn der letzte Baum gefällt oder die letzte Biene verendet ist, werden die Leute verstehen warum Umweltschutz wichtig ist.

Post Reply