photoshopAction
The module that facilitates Actions being performed in the
UXP-Photoshop world. You may perform your own batchPlay
commands,
or attach listeners using this module.
Copied to your clipboardvar PhotoshopAction = require('photoshop').action;
Functions#
addNotificationListener#
Promise<void>
Attach a listener to a Photoshop event. A callback in the form
of (eventName: string, descriptor: Descriptor) => void
will be performed.
Copied to your clipboardawait PhotoshopAction.addNotificationListener(['open'], onOpenNewDocument)
Parameters#
Name | Type |
---|---|
events | string[] |
notifier | NotificationListener |
batchPlay#
Promise<ActionDescriptor[]>
Performs a batchPlay call with the provided commands. Equivalent
to an executeAction
in ExtendScript.
Copied to your clipboard1var target = { _ref: 'layer', _enum: 'ordinal', _value: 'targetEnum'}2var commands = [{ _obj: 'hide', _target: target }]3await PhotoshopAction.batchPlay(commands)
Parameters#
Name | Type |
---|---|
commands | ActionDescriptor[] |
options? | BatchPlayCommandOptions |
batchPlaySync#
Performs a batchPlay call with the provided commands. Equivalent
to an executeAction
in ExtendScript.
Copied to your clipboard1var target = { _ref: 'layer', _enum: 'ordinal', _value: 'targetEnum'}2var commands = [{ _obj: 'hide', _target: target }]3await PhotoshopAction.batchPlay(commands)
Parameters#
Name | Type |
---|---|
commands | ActionDescriptor[] |
options? | BatchPlayCommandOptions |
removeNotificationListener#
Promise<void>
Detaches a listener from a Photoshop event.
Parameters#
Name | Type |
---|---|
events | string[] |
notifier | NotificationListener |
validateReference#
boolean
Synchronously validates the given action reference, returning true if it still exists. For example, calling this with a closed document would return false.
Parameters#
Name | Type |
---|---|
ref | ActionReference | ActionReference[] |