Pixen JavaScript API
    Preparing search index...

    Pixen JavaScript API

    Every Pixen script defines a main(document) function. Pixen calls main with the current document, which provides access to its canvas, layers, selection, and animation.

    For example:

    function main(document) {
    const canvas = document.canvas;
    }

    Installed scripts can also be run against the current document with AppleScript. The command returns the script's console messages as a list:

    tell application "Pixen" to run JavaScript named "Tile Bricks"
    

    You can also run any JavaScript file by passing its path:

    tell application "Pixen" to run JavaScript POSIX file "/Users/me/Scripts/My Script.js"