Internal command

From TotalcmdWiki
Jump to: navigation, search

Most internal commands of Total Commander can be used e.g. in the Buttonbar or assigned to a custom hotkey. The commands in question are listed in the file totalcmd.inc located in the program directory of Total Commander. Additionally, you can create new internal commands yourself which can be used the same way (see user-defined command).

There are several ways to use those commands:


Buttonbar

Do a rightclick on an empty place of the buttonbar, then a Context menu with 'change' appears what you should click.

Or you press [Alt]+[o], then [b].

Now it opens the Change Button Bar dialog:

Buttonbar dialog.png

Pressing the "Append" button adds a new button after the current selected button.

Now enter the appropriate command into the "Command" field or activate the field by pressing [Alt]+[C] and use the down-key to scroll through the internal commands until you found the desired. Of yourse you can also click on the "arrow down" symbol at the right end of the command box to open the list with all commands.

Dropdown.png


Now you have only to select any Icon file and press OK and you could use the button.

Hotkey

You can define a hotkey for the internal command. Open Configuration->Options->Misc, select an appropriate Hotkey in the "Redefine Hotkeys (keyboard remapping)" section and open the dropdownlist to choose the command Config-Miscdropdown.png

Alias

You can define an alias for the internal command. Open Configuration->Options->Misc, click on the Alias option, type the alias you want to create and open the dropdownlist to choose the command.

Startmenu

Press [Alt]+[S] to open the Start menu (of Total Commander)and the [s] to open the "Change star menu " dialog box.

Change startmenu.png

After pressing the "Add Item" button and defining a name you can again either type the command into the "Command" field or open the dropdown list with all commands by clicking the down arrow beside the "Command" edit field. You should not use the "Shortcut key" field to define a shortcut because this interferes with the above mentioned "Redefine Hotkeys (keyboard remapping)" feature. Apart from this you are here restricted to the F-keys with modifiers.

After you have added the Command it wil be available in the start menu.

Main menu

You can also edit your main menu and add the command. The Menu is a plain text file with a special syntax. It's default location is in the "language" subdirectory in the program directory of Total Commander. Usually it's name is derived from the language file. e.g WCMD_ENG.LNG is the english language file and the corresponding menu file is WCMD_ENG.MNU where the extension MNU is mandatory.

The menu file looks like this:


POPUP "&Files"
  MENUITEM "&Change Attributes...", cm_SetAttrib
  MENUITEM "&Pack...\tAlt+F5", cm_PackFiles
  MENUITEM "&Unpack...\tAlt+F9", cm_UnpackFiles
  MENUITEM "Test Arch&ive(s)\tAlt+Shift+F9",518
  MENUITEM "Compare B&y Content...", 2022
  MENUITEM "&Associate With...", cm_associate
  MENUITEM "Properties&...\tAlt+Enter", cm_versioninfo
  MENUITEM "Calculate &Occupied Space...", cm_GetFileSpace
  MENUITEM "Multi-&Rename-Tool...\tCtrl+M", 2400
  MENUITEM "Edit Comme&nt...\tCtrl+Z", 2700
  POPUP "Prin&t"
    MENUITEM "File &List...", 2027
    MENUITEM "File List With &Subdirs...", 2028
    MENUITEM "File Con&tents\tCtrl+F9", cm_PrintFile
  END_POPUP
  MENUITEM SEPARATOR
  MENUITEM "&Split File...", 560
  MENUITEM "Co&mbine Files...", 561
  MENUITEM "&Encode File (MIME,UUE,XXE)...", 562
  MENUITEM "&Decode File (MIME,UUE,XXE,BinHex)...", 563
  MENUITEM "Create CRC C&hecksums (SFV format)...", 564
  MENUITEM "&Verify CRC Checksums (from SFV files)", 565
  MENUITEM SEPARATOR
  MENUITEM "&Quit\tAlt+F4", 24340
END_POPUP

A popup menu is defined between the POPUP / END_POPUP tags. (here you can see the 'Files' menu of the english version).

A command in those POPUP menu is defined with MENUITEM. It is followed by the name that is displayed in the menu enclosed in quotation marks. Then separates the colon the actual command.

In the example above the Number of the command is used (you can find those numbers also in the totalcmd.inc file. But you may also use the "cm_CommadName" instead.

So if you want to add to the 'Files' menu the command to create a shortcut you will find in the totalcmd.in the command:

cm_CreateShortcut=1004;Create a shortcut

Thus you simply have to add a line:

MENUITEM "Create a shortcut", cm_CreateShortcut

and save the file and after restarting Total Commander you will find the command in the files POPUP.

To get a hotkey in the POPUP you'll have to use the Ampersand "&". The Char that follows the "&" will work as hotkey. In the above menu it isn't easy to find a 'free' hotkey. There are only left b, g, j, k, w, x, z. Thus you'll have to adapt the line like this:

MENUITEM "&Kreate a shortcut", cm_CreateShortcut

what will define the "K" as hotkey.

So the new menu would look like this

POPUP "&Files"
  MENUITEM "&Change Attributes...", cm_SetAttrib
  MENUITEM "&Pack...\tAlt+F5", cm_PackFiles
  MENUITEM "&Unpack...\tAlt+F9", cm_UnpackFiles
  MENUITEM "Test Arch&ive(s)\tAlt+Shift+F9",518
  MENUITEM "Compare B&y Content...", 2022
  MENUITEM "&Associate With...", cm_associate
  MENUITEM "Properties&...\tAlt+Enter", cm_versioninfo
  MENUITEM "Calculate &Occupied Space...", cm_GetFileSpace
  MENUITEM "Multi-&Rename-Tool...\tCtrl+M", 2400
  MENUITEM "Edit Comme&nt...\tCtrl+Z", 2700
  POPUP "Prin&t"
    MENUITEM "File &List...", 2027
    MENUITEM "File List With &Subdirs...", 2028
    MENUITEM "File Con&tents\tCtrl+F9", cm_PrintFile
  END_POPUP
  MENUITEM SEPARATOR
  MENUITEM "&Kreate a shortcut", cm_CreateShortcut
  MENUITEM "&Split File...", 560
  MENUITEM "Co&mbine Files...", 561
  MENUITEM "&Encode File (MIME,UUE,XXE)...", 562
  MENUITEM "&Decode File (MIME,UUE,XXE,BinHex)...", 563
  MENUITEM "Create CRC C&hecksums (SFV format)...", 564
  MENUITEM "&Verify CRC Checksums (from SFV files)", 565
  MENUITEM SEPARATOR
  MENUITEM "&Quit\tAlt+F4", 24340
END_POPUP

Directory hotlist

You can also use an internal command in the directory hotlist. If you press [Ctrl]+[D] a context menu pops up that allows either to add the current directory to the directory hotlist or to configure the directory hotlist.

You'll have to choose 'Configure...". Then, analogue to the startmenu, you'll have to add an item and can either type the command or choose it from the dropdown list you can open by clicking at the down arrow beside the "Command" edit field.

These are the most common cases how to use the internal commands.



Back to List of internal functions