Skip to main content
100%

Triggering an action in Sketch

✓ Published0🌍 Public
KKevinGutowski
Last edited Apr 6, 2021
Created on Jul 30, 2019

This example demonstrates how to trigger built-in actions in Sketch by accessing the document’s actions controller. The code uses the `actionsController()` API to invoke specific actions like `MSShowReplaceColorSheetAction` and `MSInsertSymbolAction`, passing in objects such as an `NSMenuItem` with a represented object when needed. It also includes a commented-out script that logs all available action class names to a file. The snippet illustrates direct programmatic control over Sketch’s UI, relying on Objective-C bridging through JavaScript APIs. It references `MSSymbolMasterReference` to handle symbol insertion and uses `try`/`catch` for error handling.

AI-generated description

Similar vizzes