User-defined command: Difference between revisions

From TotalcmdWiki
Jump to navigation Jump to search
(English translation)
 
(Improved the description of user-defined commands.)
 
(6 intermediate revisions by 2 users not shown)
Line 1: Line 1:
==Description==
'''User-defined commands''' are commands that can be created by the user in addition to the built-in [[internal command]]s of [[Total Commander]]. These commands can either start an external program with desired parameters, or execute a comma separated list of internal commands.
User-defined commands can be used to execute external programs in an easy way. In addition the can be used to assign a single name to an internal command which supports parameters. This is required to make them work everywhere.


These commands can be executed in various ways. User-defined commands have the em_ prefix. This is the abbreviation for extended command and was introduced to make them easy distinguishable from internal commands.
User-defined commands have the em_ prefix (which stands for extended command) to make them easy distinguishable from the built-in internal commands which generally have the cm_ prefix.


==Properties==
Use the [[Command browser]] to define and manage the user-defined commands.
User-defined commands consist of the following properties


* Command: There are two types of commands
== Usage cases ==
** An external program or document
Cases where user-defined commands are useful are:
** An internal command
* A user-defined command can be used as a shorthand name for a program or command with desired parameters.
* Parameters
* By creating a user-defined command for an external program, you can include the command to be executed in a list of commands.
* Start path
* Sometimes executing a command with parameters does not work when executing a list of commands, for example when doing this on Total Commander's command line. In that case you can create a user-defined command (without parameters) which executes the command with paramaters, so it can be executed in the list of commands.
* Icon file
* Icon
* Tooltip
* Run minimized/maximized


==Use==
==Examples==
A user-defined command can be used in many different ways
===Execute an external program===
 
This example demonstrates a user-defined command that executes an external program.
* Entered directly in command-line
* [[Hotkeys|Hotkey]]
* [[Aliases|Alias]]
* Main menu
* Start menu
* [[Directory Hotlist]]
* From external application
 
==Managing user-defined commands==
===Command browser===
The command browser can be used to manage commands in Total Commander. It can be used almost everywhere where user-defined can be used. It can be opened by clicking the button with the magnifier.
 
* Hotkey- and alias definitions: Menu Configuration/Options/Page Misc./Redifine hotkeys
* Button bar configuration: Menu Configuration/Change button bar
* Start menu configuration: Menu Configuration/Change start menu
* Directory hotlist configuration: Menu Commands/Directory hotlist


Alternatively the command browser can be opened directly be executing the internal command cm_CommandBrowser.
The user-defined command <code>em_qsp</code> is defined as:
<pre>
Command: %COMMANDER_PATH%\Addons\TC Quick Search Plus\TCQSP.exe
Parameters: %P
Icon file: %COMMANDER_PATH%\Addons\TC Quick Search Plus\TCQSP.exe
Tooltip: Quick filter
</pre>


===Create user-defined commands===
===Execute an internal command with parameters===
Here are the steps which needs to be taken starting from the command browser
This example demonstrates a user-defined command that executes an internal command with a parameter.
* Select category usercmd.ini
* Click button "New"
* Enter name for user-defined command
* Enter properties for the user-defined command.
* Close the dialog by clicking OK.
* Close the command browser by clicking OK.
 
If the command browser has been started separately just a user-defined command has been created. If the command browser has been opened from one of the above mentioned configuration dialogs the user-defined command assigned to the appropriate way to execute a command.
 
===Select user-defined command for assignment===
Additional assignments can be created at anytime. After executing the command browser from a configuration dialog please follow these steps.
* Select category usercmd.ini
* Select user-defined command in the right-hand list.
* Close command browser by clicking OK.
 
When creating a hotkey or alias definition you have to click the button with the check mark after creating or selecting the command.
 
==Examples==
===Execute external program===
In this example demonstrates how an external program is executed. The following properties must be entered
Command: %COMMANDER_PATH%\Addons\TC Quick Search Plus\TCQSP.exe
Parameters: %P
Icon file: %COMMANDER_PATH%\Addons\TC Quick Search Plus\TCQSP.exe
Tooltip: Quick filter
 
===Using an internal command with parameters as user-defined command===
Internal commands with parameters can be used directly only in button in the buttonbar, in the start menu and in the directory menu. All the other ways to execute a command listed in the section "Use" only work when the internal command with parameters is assigned to an user-defined command. Here is an example to load folder tabs from a file.


The user-defined command <code>em_myproject</code> is defined as:
<pre>
  Command: OPENTABS %appdata%\Total Commander\Tabs\My Project.tab  
  Command: OPENTABS %appdata%\Total Commander\Tabs\My Project.tab  
  Tooltip: My Project
  Tooltip: My Project
</pre>
== See also ==
* [[Alias]]


[[Category:Internal functions]]
[[de:Benutzerdefinierte_Befehle]]
[[de:Benutzerdefinierte_Befehle]]

Latest revision as of 13:36, 23 June 2024

User-defined commands are commands that can be created by the user in addition to the built-in internal commands of Total Commander. These commands can either start an external program with desired parameters, or execute a comma separated list of internal commands.

User-defined commands have the em_ prefix (which stands for extended command) to make them easy distinguishable from the built-in internal commands which generally have the cm_ prefix.

Use the Command browser to define and manage the user-defined commands.

Usage cases

Cases where user-defined commands are useful are:

  • A user-defined command can be used as a shorthand name for a program or command with desired parameters.
  • By creating a user-defined command for an external program, you can include the command to be executed in a list of commands.
  • Sometimes executing a command with parameters does not work when executing a list of commands, for example when doing this on Total Commander's command line. In that case you can create a user-defined command (without parameters) which executes the command with paramaters, so it can be executed in the list of commands.

Examples

Execute an external program

This example demonstrates a user-defined command that executes an external program.

The user-defined command em_qsp is defined as:

Command: %COMMANDER_PATH%\Addons\TC Quick Search Plus\TCQSP.exe
Parameters: %P
Icon file: %COMMANDER_PATH%\Addons\TC Quick Search Plus\TCQSP.exe
Tooltip: Quick filter

Execute an internal command with parameters

This example demonstrates a user-defined command that executes an internal command with a parameter.

The user-defined command em_myproject is defined as:

 Command: OPENTABS %appdata%\Total Commander\Tabs\My Project.tab 
 Tooltip: My Project

See also