Scripting
A script is a .js file with a name, the permissions it needs, and a run(ctx) function. Once Cursor Crane finds it, you bind a command sequence or shortcut to it exactly as you would to a built-in command.
Pages#
- Using Scripts covers the script folder, the two bundled examples, editor autocomplete, and turning a script into a command.
- Element Selectors explains the CSS-like syntax for describing which element a script should act on.
- Script API organizes the API by task: finding apps and windows, querying elements, input, clipboard, shell, and forms.
Workflow#
The practical path is copy, then simplify:
- Select your target in Element Menu Mode and choose Copy Selector.
- Paste it into a script and run it once.
- Remove the unstable parts of the selector until only useful conditions remain.
Running scripts is free during beta. See Plans and Licensing.
Working with an AI assistant#
The default script folder includes an AGENTS.md file that explains the script structure and API conventions, along with type declarations. Hand the whole folder to an AI coding assistant as context and it can write or edit scripts for you. When a script needs a specific element, copy that element's selector and pass it along.