How to create scripts in Affinity and manage your library

Last update: 29/09/2026

  • Affinity incorporates an editor for creating and running JavaScript scripts within the application.
  • The same script can act on vector, pixel, and layout elements.
  • Affinity Script Manager organizes local files and allows the installation of community scripts via MCP.
  • The scripts are still in beta: it's advisable to test them on copies and review the results.
How to create scripts in Affinity

Renaming layers, repeating a change across multiple pages, or preparing numerous files for export can be more time-consuming than the design itself. If you've already used scripts in creative applications, you're probably wondering... How to create and run scripts in Affinity and if you need additional tools to do it.

The answer has changed with the September 2026 update: Affinity incorporates a script editorIn addition to a panel where you can easily access and run them, there are also community-developed managers for organizing JavaScript files and discovering tools shared by other users. Let's distinguish what you can do within Affinity and when it makes sense to use an external application.

How scripts work in Affinity

scripts in Affinity

Affinity scripts are based on JavaScript and its own SDKwhich defines the functions available for interacting with the application. This does not mean that a file .jsx Prepared for an Adobe application to work directly: although both environments use JavaScript, each uses its own functions to access documents, layers, and tools.

Affinity brings together vector graphics, pixel editing, and layout in a single application. This means a script can work on different parts of a document without having to switch programs. You can create automations to prepare repeated elements, update components of a design, or generate variations of a project, all within the capabilities of the SDK.

Exclusive content - Click Here  What is the Miasma worm and why does it affect developers using AI?

Keep in mind that The scripting feature is still in beta.The SDK documentation may contain errors or omissions, so it's advisable to check the output of each script before using it in a major project.

Create and run scripts with the built-in editor

Open a JavaScript file in a code editor to create an Affinity script.

The most direct way is to use Affinity's built-in editorThe application allows you to write and run scripts without relying on Claude or installing Affinity Script Manager. It also includes a library of examples that helps you understand script structure before creating your own.

  1. Update Affinity to a version that includes the scripting function and opens a test document.
  2. Locate the editor and the scripts panel in the application. If the menu translation does not match the documentation, also look for the names "Scripts" or "Indexes".
  3. Open one of the included examples and observe which elements of the document it uses and modifies.
  4. Create a small version of your automation, with a change that is easy to verify, before applying it to multiple pages or layers.
  5. Run the script and check the result. When it works as expected, save it to retrieve it from the panel.

Before writing more complex functions, consult the official Affinity SDK documentationIt is the appropriate reference to check what operations exist and how they are used in the installed version.

When to use Affinity Script Manager

Code editor and AI assistant used to prepare design automations.

Affinity Script Manager It's a community-driven app independent of Affinity and Canva. It might be of interest to you if you accumulate a lot of files. .jsDo you want to maintain a local library or would you prefer to explore scripts published by other people from a single interface?

Exclusive content - Click Here  How to migrate from Google Photos to Immich: A Complete Guide to Recovering Your Memories

The project offers an Ace-based editor, options for importing and exporting scripts, and a community tools section. It also includes Watch ModeWhen you save changes to an already installed script, the manager attempts to send it back to Affinity. To communicate between the two applications, it uses Affinity's local MCP bridge; this connection is necessary for installing scripts through the manager.

If you want to try it, download it from the repository of its developer on GitHubYou can start by importing your own script into your local library and then checking if it appears in Affinity. For third-party scripts, review the code and test it first on a copy of a document.

How to share scripts and community repositories

A file .js The script you share via Affinity Script Manager may include a comment with its metadata at the beginning. The manager uses this information to display the name and description in its library. According to the project documentation, name It is mandatory, description It is recommended and version It is optional.

/**
 * name: Preparar capas para exportar
 * description: Organiza las capas seleccionadas antes de exportarlas.
 * version: 1.0.0
 */

That block just describe the scriptBelow, you must add the code that will execute the task. Use a name that explains what it does and document any important conditions, such as the need to select layers before running it.

If you want to keep your own public catalog Compatible with the manager, its documentation explains how to create a GitHub repository with a file registry.json in the root directory. This record indicates where to download each script and may include categories and sample images. The file featured.json It's optional and controls the featured items in that repository. To propose a script to the existing community catalog, its maintainers indicate another way: submit a proposal via a GitHub issue for review.

Exclusive content - Click Here  How to enable AHCI mode in HP BIOS step by step

What to check if a script doesn't appear or isn't working

First distinguish where the process failsIf you're using the Affinity editor and the script runs but doesn't produce the expected result, check the code, the open document, the active selection, and the SDK features it uses. Test it on a small file before repeating it on a large project.

If the problem appears when install a script from Affinity Script ManagerVerify that Affinity is open and that MCP is enabled with permission to save scripts. The developer of the script manager also recommends opening the script panel and creating at least one category before attempting the installation again.

On macOS, the manager may display a warning because your application is not notarized. If you decide to install it, download it from the developer's repository, verify that it corresponds to the project you want to use, and follow the system's security instructions.

To begin automating Affinity, The built-in editor and its examples are sufficient.The community manager provides organization and access to more scripts as your library grows. Regardless of the method, keep a copy of the original document and always review changes and exports before submitting your work.