---
title: "script.run: Run Script — Motion kit command — Kition"
description: "run JavaScript (the scripting object model: `app.project`, comps, layers, properties…) and report `{ok, result, output, error}`; script errors are reported in `error` (with line and column), not as a command failure."
canonical: "https://developer.kition.ai/docs/kits/motion/commands/script.run"
---

> Canonical HTML: [https://developer.kition.ai/docs/kits/motion/commands/script.run](https://developer.kition.ai/docs/kits/motion/commands/script.run)

# script.run

**Run Script.** run JavaScript (the scripting object model: `app.project`, comps, layers, properties…) and report `{ok, result, output, error}`; script errors are reported in `error` (with line and column), not as a command failure.

- Kit: Motion 0.1.0 (.kmotion); reference: [Motion kit commands](https://developer.kition.ai/docs/kits/motion.md)
- Changes the document: yes

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `code` | `string` | no | JavaScript: app, app.project, CompItem, Layer, Property… as in the usual scripting object model |
| `console` | `boolean` | no | Script Console context |
| `name` | `string` | no |  |

## Call through motion_run

```text
motion_run {
  "path": "<file>.kmotion",
  "steps": [{ "command": "script.run" }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `code`, `console`, `name`. motion_run answers the step’s result in `completed[i].result`.

## Result

The kit gives no result schema for this command.

## Parameter schema

```json
{
  "additionalProperties": false,
  "properties": {
    "code": {
      "description": "JavaScript: app, app.project, CompItem, Layer, Property… as in the usual scripting object model",
      "type": "string"
    },
    "console": {
      "description": "Script Console context",
      "type": "boolean"
    },
    "name": {
      "type": "string"
    }
  },
  "returns": "{ok, result, output, error: {message, line, column} | null}",
  "type": "object"
}
```

Generated from the command list of @kition/motion-darwin-arm64@0.1.0 and the kit itself (motion_commands through @kition/cli@0.1.1, built from KitionAI/kition-motion@4719aa7).
