src/pages/scripting/index.md
UXP scripting allows developers to execute a single file to accomplish tasks in Photoshop. Unlike ExtendScript, these scripts can utilize the UXP and Photoshop APIs to communicate with Photoshop.
Scripts are mainly used to perform one-off tasks that end-users would otherwise perform manually. It is especially useful when the task is repetitive in nature, such as adding a watermark to your documents. When a script is invoked by a user, it executes a task and is unloaded by Photoshop once it’s done. If required, a dialog can be used to prompt the user for inputs. Scripts can be executed in a headless manner or with minimal UI, without the need for any manifest setup.
The biggest advantage that scripting offers is its simplicity. You can accomplish tasks in Photoshop without requiring as elaborate of a setup as that of a UXP plugin. Any script code can be reused in a UXP plugin as well.
window.localStorage.Legacy extensibility platforms supported scripting in ExtendScript. ExtendScript uses a very old version of JavaScript (ES3), while UXP uses the V8 JavaScript engine which supports ES6. Developers can write scripts while utilizing the flexibility offered by modern JavaScript.
Compared to ExtendScript, UXP scripting makes it much easier for developers to access the Photoshop DOM (thanks to the Photoshop API!). Until all significant features are available via UXP, you can use a feature called batchPlay to talk to Photoshop elements.