# cp.dev

A set of handy developer tools for CommandPost.


# API Overview

Functions - API calls offered directly by the extension

  • elementAtMouse
  • findUnusedLanguageStrings
  • highlight
  • highlightFrame
  • highlightPoint
  • hotkey
  • inspect
  • inspectAtMouse
  • inspectElement
  • inspectElementAtMousePath
  • test
  • which

# API Documentation

# Functions

# elementAtMouse

Signature cp.dev.elementAtMouse() -> axuielementObject
Type Function
Description Gets the AX element under the current mouse position.
Parameters
  • None
Returns
  • None
Notes None
Examples None
Source src/extensions/cp/dev/init.lua line 146

# findUnusedLanguageStrings

Signature cp.dev.findUnusedLanguageStrings() -> string
Type Function
Description Searches for any unused language strings in English.json.
Parameters
  • None
Returns
  • A string with the results of the search.
Notes None
Examples None
Source src/extensions/cp/dev/init.lua line 66

# highlight

Signature cp.dev.highlight(element) -> axuielementObject
Type Function
Description Highlights an AX element on the screen.
Parameters
  • element - The AX element to highlight.
Returns
  • The element.
Notes None
Examples None
Source src/extensions/cp/dev/init.lua line 277

# highlightFrame

Signature cp.dev.highlightFrame(frame) -> none
Type Function
Description Highlights aa frame on the screen.
Parameters
  • frame - A hs.geometry frame object.
Returns
  • None
Notes None
Examples None
Source src/extensions/cp/dev/init.lua line 319

# highlightPoint

Signature cp.dev.highlightPoint(point) -> none
Type Function
Description Highlights a point on the screen.
Parameters
  • point - A hs.geometry point object.
Returns
  • None
Notes None
Examples None
Source src/extensions/cp/dev/init.lua line 352

# hotkey

Signature cp.dev.hotkey(fn) -> none
Type Function
Description Assigns a function to the CONTROL+OPTION+COMMAND+SHIFT+Q keyboard combination.
Parameters
  • fn - A function to execute when the hotkey is triggered.
Returns
  • None
Notes None
Examples None
Source src/extensions/cp/dev/init.lua line 53

# inspect

Signature cp.dev.inspect(item, options) -> string
Type Function
Description Inspect an item.
Parameters
  • item - The object to inspect.
  • options - Any additional options to pass along to cp.dev.inspectElement.
Returns
  • A results as a string.
Notes None
Examples None
Source src/extensions/cp/dev/init.lua line 195

# inspectAtMouse

Signature cp.dev.inspectAtMouse(options) -> none
Type Function
Description Inspects an AX element under the current mouse position. Writes results to Debug Console.
Parameters
  • options - Any additional options to pass along to cp.dev.inspectElement.
Returns
  • None
Notes None
Examples None
Source src/extensions/cp/dev/init.lua line 159

# inspectElement

Signature cp.dev.inspectElement(element[, options]) -> none
Type Function
Description Inspect an AX element. Writes results to Debug Console.
Parameters
  • element - The element to inspect.
  • options - A table containing any optional values.
Returns
  • None.
Notes
  • The options table accepts the following parameters:
  • depth - A number representing the maximum depth to recurse into variable.
Examples None
Source src/extensions/cp/dev/init.lua line 234

# inspectElementAtMousePath

Signature cp.dev.inspectElementAtMousePath(options) -> none
Type Function
Description Inspects an AX element at the mouse path.
Parameters
  • options - A table containing any optional values.
Returns
  • None
Notes None
Examples None
Source src/extensions/cp/dev/init.lua line 393

# test

Signature cp.dev.test(id) -> cp.test
Type Function
Description This function will return a cp.test.
Parameters
  • id - the id to test.
Returns
  • A [cp.test] to execute.
Notes
  • This function will return a cp.test with either the name <id>_test or <id>._test if the <id> is pointing at a folder.
  • For example, you have an extensions called foo.bar, and you want to create a test for it.
  • Option 1: <id>_test
  • File: /src/tests/foo/bar_test.lua
  • Option 2: <id>._test
  • File: /src/tests/foo/bar/_test.lua
  • You could then run all the contained tests like so:
  • lua</li><li>_test("foo.bar")()</li><li>
Examples None
Source src/extensions/cp/dev/init.lua line 406

# which

Signature cp.dev.which(cmd) -> none
Type Function
Description The which utility takes a list of command names and searches the path for each executable file that would be run had these commands actually been invoked.
Parameters
  • cmd - The parameters to pass along to the which executable.
Returns
  • The path or nil and the error message if an error occurs.
Notes None
Examples None
Source src/extensions/cp/dev/init.lua line 122