docs » cp.commands.command


Commands Module.

API Overview

API Documentation

Fields

isActive

Signature cp.commands.command.isActive <cp.prop: boolean; read-only>
Type Field
Description Indicates if the command is active. To be active, both the command and the group it belongs to must be enabled.

isEnabled

Signature cp.commands.command.isEnabled <cp.prop: boolean>
Type Field
Description If set to true, the command is enabled.

Methods

activated

Signature cp.commands.command:activated(repeats) -> command
Type Method
Description Executes the 'pressed', then 'repeated', then 'released' functions, if present.
Parameters
  • `repeats` - the number of times to repeat the 'repeated' function. Defaults to 1.
Returns
  • the last 'truthy' result (non-nil/false).

activatedBy

Signature cp.commands.command:activatedBy([modifiers,] [keyCode]) -> command/modifier
Type Method
Description Specifies that the command is activated by pressing a key combination.
Parameters
  • `modifiers` - (optional) The table containing names of required modifiers.
  • `keyCode` - (optional) The key code that will activate the command, with no modifiers.
Returns
  • `command` if a `keyCode` was provided, or `modifier` if not.

addShortcut

Signature cp.commands.command:addShortcut() -> command
Type Method
Description Adds the specified shortcut to the command.
Parameters
  • `newShortcut` - the shortcut
Returns
  • `self`

deleteShortcuts

Signature cp.commands.command:deleteShortcuts() -> command
Type Method
Description Sets the function that will be called when the command key combo is pressed.
Parameters
  • None
Returns
  • command - The current command

getFirstShortcut

Signature cp.commands.command:getFirstShortcut() -> command
Type Method
Description Returns the first shortcut, or nil if none have been registered.
Parameters
  • None
Returns
  • The first shortcut, or `nil`.

getShortcuts

Signature cp.commands.command:getShortcuts() -> command
Type Method
Description Returns the set of shortcuts assigned to this command.
Parameters
  • None
Returns
  • The associated shortcuts.

new

Signature cp.commands.command:new() -> command
Type Method
Description Creates a new command, which can have keyboard shortcuts assigned to it.
Parameters
  • `id` = the unique identifier for the command. E.g. 'cpCustomCommand'
Returns
  • command - The command that was created.

pressed

Signature cp.commands.command:pressed() -> command
Type Method
Description Executes the 'pressed' function, if present.
Parameters
  • None
Returns
  • the result of the function, or `nil` if none is present.

released

Signature cp.commands.command:released() -> command
Type Method
Description Executes the 'released' function, if present.
Parameters
  • None
Returns
  • the result of the function, or `nil` if none is present.

repeated

Signature cp.commands.command:repeated(repeats) -> command
Type Method
Description Executes the 'repeated' function, if present.
Parameters
  • `repeats` - the number of times to repeat. Defaults to 1.
Returns
  • the last result.

titled

Signature cp.commands.command:titled(title) -> command
Type Method
Description Applies the provided human-readable title to the command.
Parameters
  • `id` = the unique identifier for the command. E.g. 'FCPXHacksCustomCommand'
Returns
  • command - The command that was created.

whenActivated

Signature cp.commands.command:whenActivated(function) -> command
Type Method
Description Sets the function that will be called when the command is activated.
Parameters
  • `activatedFn` - the function to call when activated.
Returns
  • command - The current command

whenPressed

Signature cp.commands.command:whenPressed(function) -> command
Type Method
Description Sets the function that will be called when the command key combo is pressed.
Parameters
  • `pressedFn` - the function to call when pressed.
Returns
  • command - The current command

whenReleased

Signature cp.commands.command:whenReleased(function) -> command
Type Method
Description Sets the function that will be called when the command key combo is released.
Parameters
  • `releasedFn` - the function to call when released.
Returns
  • command - The current command

whenRepeated

Signature cp.commands.command:whenRepeated(function) -> command
Type Method
Description Sets the function that will be called when the command key combo is repeated.
Parameters
  • `repeatedFn` - the function to call when repeated.
Returns
  • command - The current command

results matching ""

    No results matching ""