Komodo User Guide

Running Commands

New to the Run Command feature?
Check out the Run Command Tutorial

Use the Run Command dialog box to interact with the system command line or shell while editing or debugging files in Komodo. Besides making it easier to run simple and complex custom commands from within Komodo, the Run Command dialog can insert the results of shell commands into the document in the Editor pane, or pass the contents of the document to the system command line or shell.

Run Command Input/Output Options

The Run Command Dialog Box (Standard)

Select Tools|Run Command, or use the keyboard shortcut Ctrl+R, to open the Run Command dialog box. Alternatively, invoke the Run Command dialog from the Project Manager or the Toolbox by selecting Add New Command from one of Komodo's Context menus. Choose from the following options:

  • Run field: enter the command that you want to run.
    • Click the arrow button to the right of the Run field to view a drop-down list of command shortcuts. Select a shortcut from the drop-down list to enter it in the Run field.
  • Run button: click to run a command.
  • Insert output: if this check box is selected, the results of the command are inserted at the cursor position in your current document.
  • Pass selection as input: if this check box is selected, the selected contents of a file are passed to a command.
  • Add to Toolbox: if this check box is selected, the command is saved in the Toolbox.
  • More: click this button to display Advanced Options.

Run Command Shortcuts

Enter command shortcuts in the Run field, or select them from the drop-down list to the right of the Run field. It is a good idea for Windows users to enclose all Komodo shortcuts (with the exception of %(browser)) in double quotation marks. This is necessary to ensure that any spaces in filenames or file paths are interpreted correctly. The following are common Run Command shortcuts:

  • %%: escaped percent symbol; interpolates the "%" character, which is otherwise used to signify a shortcut. For example, you could type:
    Path = C:\foo; %%PATH%% to insert the directory "foo" at the beginning of the PATH statement
  • %f: file base name; interpolates the name of the file that is currently in focus in the Komodo Editor pane
  • %F: file path; interpolates the full path and name of the file that is currently in focus in the Komodo Editor pane
  • %d: directory base name of file; interpolates the name of the directory of the file currently in focus in the Komodo Editor pane
  • %D: directory path of file; interpolates the entire directory path of the file that is currently in focus in the Komodo Editor pane
  • %s: selected text; interpolates the text that is currently selected in the Komodo Editor pane
  • %S: URL-escaped selection; replaces characters that are not valid in a query string, such as spaces and ampersands
  • %w: word under cursor; interpolates the word that is currently under the cursor in the Komodo Editor pane
  • %W: URL-escaped selection of word under cursor; replaces characters that are not valid in a query string, such as spaces and ampersands
  • %(browser): launches configured browser ( as specified in Komodo's Preferences)
  • %(perl): path and name of Perl interpreter as specified in Komodo's Preferences; for example, you could enter the command %(perl) "%F" to run the current file with the configured perl interpreter
  • %(php): interpolates the path and name of the PHP interpreter configured in Komodo's Preferences For example, you could enter the command %(php) "%F" to the current file with the configured php interpreter
  • %(python): interpolates the path and name of the Python interpreter configured in Komodo's Preferences For example, you could enter the command %(python) "%F" to run the current file with the configured python interpreter
  • %(tclsh): interpolates the path and name of the tclsh interpreter configured in Komodo's Preferences For example, you could enter the command %(tclsh) "%F" to run the current file with the configured tclsh interpreter for the TCL language
  • %(wish): interpolates the path and name of the wish interpreter configured in Komodo's Preferences For example, you could enter the command %(wish) "%F" to run the current file with the configured wish interpreter for the TCL language
  • %(ask): ask when command is run; always prompts user to enter input in the Interpolation Query dialog box before running the command. The complete syntax for the %(ask) shortcut is:
    "%(ask[:NAME:[DEFAULT]])"
    where "NAME" is an optional name to insert in the Interpolation Query dialog box and "DEFAULT" is an optional default value that appears in the dialog box.
  • Note that you can customize any Run Command shortcut using the %(...:orask) modifier. The syntax for a modified shortcut is:
    "%(SHORTCUT:orask[:NAME])"
    where "SHORTCUT" is the shortcut as displayed in the shortcut drop-down list and "NAME" is an optional name to insert in the Interpolation Query dialog box. See the Run Command Tutorial for examples of %(ask) and %(...:orask) shortcuts.

    For a complete list of shortcuts, along with options and syntax for shortcuts, see Interpolation Shortcuts.

The Run Command Dialog Box (Advanced Options)

Clicking the More button displays the Advanced Options portion of the Run Command dialog box. Notice that, when Advanced Options are displayed, the More button becomes the Less(M) button. Clicking the Less(M) button hides Advanced Options.

  • Start in: enter the directory in which you want run the command.
    • Click the arrow button to the right of the Start in field to view a drop-down list of command shortcuts. Select a shortcut from the drop-down list to enter it in the Start in field.
  • Run in: select an option from this drop-down list to choose the type of interface in which to run the command. The options are:
    • Command Output Window: the output from the command will be displayed on the Command Output tab of the Output pane.
    • New Console: the output from the command will be displayed in a new shell or command window.
    • No Console (GUI Application): the command will launch the specified application without displaying output in a shell or on the Command Output tab.
  • Do not open output pane: if this check box is selected, the Output pane does not automatically open when you run a command.
  • Parse output with: if this check box is selected, the field to the right becomes active so that you can enter a regular expression with which to parse.
  • Show parsed output as list: if this check box is selected, output is displayed in a list format on the Command Output tab.
  • New: click this button to open the Environment Variable dialog box. The Environment Variable dialog box contains three options:
    • Variable Name: enter a name for the variable in this field.
    • Variable Value: enter a value for the variable in this field.
    • Add Path...: click this button to choose a folder from the directory tree to insert as the variable value.
  • Edit...: click this button to open an existing environment variable for editing.
  • Delete: click this button to delete a selected variable from the Environment Variables list box.
  • Save advanced options as defaults: if this check box is selected, the current settings will be stored as the defaults for the Run Command dialog box.

Run Command Shortcuts

Enter command shortcuts in the Start in field, or select them from the drop-down list to the right of the Start in field. It is a good idea for Windows users to enclose all Komodo shortcuts (with the exception of %(browser)) in double quotation marks. This is necessary to ensure that any spaces in filenames or file paths are interpreted correctly. Choose from the following shortcuts:

  • %%: escaped percent symbol; interpolates the "%" character, which is otherwise used to signify a shortcut. For example, you could type:
    Path = C:\foo; %%PATH%% to insert the directory "foo" at the beginning of the PATH statement
  • %D: directory path of file; interpolates the entire directory path of the file that is currently in focus in the Komodo Editor pane
  • %(ask): ask when command is run; always prompts user to enter input in the Interpolation Query dialog box before running the command. The complete syntax for the %(ask) shortcut is:
    "%(ask[:NAME:[DEFAULT]])"
    where "NAME" is an optional name to insert in the Interpolation Query dialog box and "DEFAULT" is an optional default value that appears in the dialog box.
  • Note that you can customize any Run Command shortcut using the %(...:orask) modifier. The syntax for a modified shortcut is:
    "%(SHORTCUT:orask[:NAME])"
    where "SHORTCUT" is the shortcut as displayed in the shortcut drop-down list and "NAME" is an optional name to insert in the Interpolation Query dialog box. See the Run Command Tutorial for examples of %(ask) and %(...:orask) shortcuts.

    For a complete list of shortcuts, along with options and syntax for shortcuts, see Interpolation Shortcuts.

The Command Output Tab

By default, the results of commands run in the Run Command dialog box are displayed on the Command Output tab. The Command Output tab is on the Output pane at the bottom of the Komodo workspace.

  • If a command accepts input, you can enter it directly into the Command Output tab of the Output pane.
  • Output written to "stderr" (standard error output) is displayed in red at the top of the Command Output tab.
  • Click the Close button at the top right of the Command Output tab to terminate a running command.
  • Click the Toggle Raw/Parsed Output View button to quickly jump from parsed results to raw output and vice versa.

You can access the last ten commands entered in the Run Command dialog box by selecting Tools|Recent Commands, or using the Alt+t, m, number keyboard shortcut (where "number" represents the sequence number of the previous command). The prefixes [i], [l] and [il] indicate that Insert output, Pass selection as input, or both were used with the original command.

Top

Running Simple Commands

A simple Run Command dialog box with standard features is displayed by default in Komodo. Use the default Run Command dialog box to run commands, pass selections from documents as input, insert command output into documents, and add commands to the Toolbox.

Running a Command

To run a command and display the results on the Command Output tab:

  1. Select Tools|Run Command.
  2. In the Run field, enter the command.
  3. Click the Run button to run the command. The results are displayed on the Command Output tab.

Passing a Selection as Input

Select the Pass selection as input check box to pass selected contents from a file to the command of your choice. To pass a selection as input:

  1. In the Editor pane, open the file containing the text that you want to pass.
  2. Select the text to be passed.
  3. Select Tools|Run Command.
  4. In the Run field, enter the command.
  5. Select the Pass selection as input check box. If the selection consists of one or more lines, the check box will be selected automatically.
  6. Click the Run button to run the command.

Inserting Command Output

Select the Insert output check box To insert output from a command into a document. To insert command output:

  1. Open the destination document in the Editor pane.
  2. Select Tools|Run Command.
  3. In the Run field, enter a command.
  4. Select the Insert output check box, then click the Run button.

Adding a Command to the Toolbox

Select the Add to Toolbox check box to store a command in the Toolbox for reuse. To add a command to the Toolbox:

  1. Select Tools|Run Command.
  2. In the Run field, enter the command.
  3. Select the Add to Toolbox check box.
  4. Click the Run button to run the command. The command is added to the Toolbox. In the Toolbox, click on the icon next to the command to run it again.

To edit a command stored in the Toolbox, right click on any saved command and select Properties. This will display the Command Properties dialog box, in which you can edit the options for saved commands. You can also assign a Key Binding to a command to invoke it with the keyboard instead of the mouse.

Top

Running Advanced Commands

Click the More button to display the Advanced Options portion of the Run Command dialog box. With Advanced Options, you can create and edit environment variables for your system, select a location for running a command, and save specific advanced options as your default settings.

Specifying Environment Variables

You can set environment variables for your system from the Run Command dialog box. For example, you may want to include key Perl or Python files in your system's PATH. To specify an environment variable:

  1. Select Tools|Run Command.
  2. In the Run field, enter a command.
  3. Click New.... The Environment Variable dialog box will open.
  4. Enter a Variable Name
  5. Click Add Path... to select a directory, or manually enter a Variable Value.
  6. Click the Run button to display all environment variables. Scroll through the results to view the environment variable you have just specified.

Running a Command in a New Console

To run a command in a separate console window:

  1. Select Tools|Run Command.
  2. In the Run field, enter a command.
  3. From the Run in drop-down list, choose New Console.
  4. Click the Run button to run the command in a new console.

Running a Command in Another Application

To run a command in another GUI application:

  1. Select Tools|Run Command.
  2. In the Run field, enter the command for the application (e.g., mozilla or iexplore).
  3. From the Run in drop-down list, choose No Console (GUI Application).
  4. Click the Run button to run the command in another application.

Saving Advanced Options as Defaults

To save selected options and entries as the defaults for the Run Command dialog box:

  1. Select Tools|Run Command.
  2. Select the options and enter the specifications that you want to save as defaults.
  3. Select the Save advanced options as defaults check box at the bottom of the Run Command dialog box.
  4. Click the Run button to run the command. When you reopen the Run Command dialog box, you will notice that the previous settings are intact.

To clear some or all of the Advanced Options, deselect and delete unwanted settings, then select the Save advanced options as defaults check box.

Top