Installing Scripts for Affinity

dailyRushes Scripts for Affinity

A script adds a new tool to Affinity. Each one comes as a .js file, which you add to your Script Library once. After that it is ready to run on any document.

Before you start

  1. You need Affinity 3 (by Canva) with scripting available.
  2. If the script came in a .zip file, unzip it first. Keep any instructions that came with it.

Add a script

  1. Open the .js file in any text editor (Notepad is fine). Select all of it and copy it.
  2. In Affinity, choose Window > Scripting > Script Editor and create a new script.
  3. Paste the code in, replacing anything already there.
  4. Enter the script’s name and a short description. The instructions that came with the script give both. Keep the description on one line, with no line breaks.
  5. Click the Malicious Script Advisor button and read what it says. See Check the script below.
  6. Save it to your Script Library.

It now appears in your Script Library.

Run a script

  1. Choose Window > Scripting > Script Library.
  2. Select what the script needs, if anything. The script’s help page says what to select.
  3. Click the script. A single click runs it.

Check the script

The Malicious Script Advisor looks through a script before you save it. For a good copy it should report “This script does not appear to be malicious”, followed by a short description of what the script does.

If it reports anything else, your copy may be incomplete or altered. Download it again and paste it in again.

The advisor is AI-based and notes that it can make mistakes, so treat it as a sensible check rather than a guarantee. It is good practice to check any script you did not write yourself this way.

Update to a newer version

The quickest way is to update the script you already have:

  1. Open the script in the Script Editor.
  2. Select everything and paste the new version over it.
  3. Save it. It keeps its name in your Script Library.

To add it as a new script instead, delete the old one from your Script Library first, then follow Add a script above with the same name. Affinity will not save a new script over one with the same name.

Scripts that open or save files

Affinity only lets scripts use folders you have allowed. A script that opens or saves files needs this:

  1. Choose Edit > Settings > Scripting.
  2. Turn on Access the file system.
  3. Under File system access, click Add and choose a folder, such as your Desktop. Folders inside it can be used too.

Scripts that only change your artwork don’t need this. A script’s help page says if it does.

If it doesn’t work

What you see Fix
“A script with that title already exists” when saving An earlier copy is already in your Script Library. Delete it first, or save the new one under a different title.
The advisor reports something unexpected Your copy may be incomplete. Copy the whole file again, making sure nothing was left behind, or download it again.
The script doesn’t appear in the Script Library It wasn’t saved. Go back to the Script Editor and save it to your Script Library.
A script can’t open or save files Allow a folder for it. See Scripts that open or save files above.