A wrapper for simplifying Photoshop Action Manager code written in Python into a human-readable tree structure. Can work with a JSON tree or an AM Object tree. Uses the Photoshop Python API to send commands to Photoshop.
pip install ps-action-manager
- Take this action manager code for example:
# Setup
import photoshop.api as ps
app = ps.Application()
sID = app.stringIDToTypeID
cID = app.charIDToTypeID
# Run the action
desc1 = ps.ActionDescriptor()
list1 = ps.ActionList()
ref1 = ps.ActionReference()
ref1.PutEnumerated(sID("layer"), sID("ordinal"), sID("targetEnum"))
list1.PutReference(ref1)
desc1.PutList(sID("target"), list1)
app.Executeaction(sID("show"), desc1, ps.DialogModes.DisplayNoDialogs)
- This code could be represented using PS Action Manager like so:
# Import object types needed
from src._action_manager import ActionManager
from src.data_types.AMList import AMList
from src.data_types.AMName import AMName
from src.data_types.AMReference import AMReference
# Run the action
ActionManager(
"show",
AMList(
"target",
AMReference(
tree=AMName(
"layer",
"Layer 1"
)
)
)
)
# Formatted in JSON to pass to JSONActionManager
tree = {
"dialog": "no",
"action": "show",
"tree": [
"<list>",
"target",
[
"<reference>",
[
"<name>",
"layer",
"Layer 1"
]
]
]
}