<!--
{
  "availability" : [
    "macCatalyst: 14.0.0 -",
    "macOS: 10.4.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "Automator",
  "identifier" : "/documentation/Automator/AMAppleScriptAction/script",
  "metadataVersion" : "0.1.0",
  "role" : "Instance Property",
  "symbol" : {
    "kind" : "Instance Property",
    "modules" : [
      "Automator"
    ],
    "preciseIdentifier" : "c:objc(cs)AMAppleScriptAction(py)script"
  },
  "title" : "script"
}
-->

# script

An `OSAScript` object representing the receiver’s script containing the `on run` command handler.

```
@NSCopying var script: OSAScript? { get set }
```

## Discussion

By default, `script` is `main.applescript`, which is stored in the action bundle. You can use `setScript:` to set the receiver’s script to `newScript`, where `newScript` must be an `OSAScript` object that could be instantiated from a script in the action bundle. `script` must contain the `on run` command handler.

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)