---
title: "script.run: Run JavaScript — PDF kit command — Kition"
description: "Run Acrobat JavaScript in the document, as the JavaScript console does (or as push button `field`'s Mouse Up script when field is given; on a laid-out XFA form, `field` runs that button's XFA click script instead, JavaScript or FormCalc, which can add and remove rows and show or hide subforms). The form object model is available: this/getField, event, app, util, console, display, color, and the document-level scripts. Field changes and resetForm are applied as one undoable step; returns the script's alerts, console output, requests (print, page, url, submit) and error."
canonical: "https://developer.kition.ai/docs/kits/pdf/commands/script.run"
---

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

# script.run

**Run JavaScript.** Run Acrobat JavaScript in the document, as the JavaScript console does (or as push button `field`'s Mouse Up script when field is given; on a laid-out XFA form, `field` runs that button's XFA click script instead, JavaScript or FormCalc, which can add and remove rows and show or hide subforms). The form object model is available: this/getField, event, app, util, console, display, color, and the document-level scripts. Field changes and resetForm are applied as one undoable step; returns the script's alerts, console output, requests (print, page, url, submit) and error.

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

## Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `field` | `string` | no | Run as this button's Mouse Up event. |
| `script` | `string` | yes |  |

## Call through pdf_run

```text
pdf_run {
  "path": "<file>.pdf",
  "steps": [{ "command": "script.run", "params": { "script": <string> } }]
}
```

The required parameters, with placeholders for their types: not a tested example. Optional: `field`. pdf_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": {
    "field": {
      "description": "Run as this button's Mouse Up event.",
      "type": "string"
    },
    "script": {
      "type": "string"
    }
  },
  "required": [
    "script"
  ],
  "type": "object"
}
```

Generated from the command list of @kition/pdf-darwin-arm64@0.1.0 and the kit itself (pdf_commands through @kition/cli@0.1.1, built from KitionAI/kition-pdf@b0d2725).
