Is there an efficient way to get full actions list? Preferably with parent (actionSet) name. Currently constructing a list of the 12 default actions (in one set) takes ~2 seconds (using forEach even up to 3 secs)
const result = []
const start = new Date().getTime();
for (let actionSet of photoshop.app.actionTree ?? []) {
for (let action of actionSet.actions ?? []) {
const item = {
title: action.name,
data: {path: [actionSet.name, action.name]},
description: actionSet.name,
}
result.push(item)
}
}
const end = new Date().getTime();
console.log("FOR", end - start);
Was thinking maybe some property that we could get with batchPlay?
Not sure if this will help since this file is a mess and I didn’t want to spend too much time with it since later I can replace its parts with DOM. But considering performance I have to decide whether to do that.
See the second screenshot “count” property of any action set. This tells you the number of sets in total. If you add more then value will increment starting with zero.
OK, this got me so confused - zero based count === 0 means there’s one set and the totally opposite one based index (probably someone at Adobe mixed up the buttons when implementing). Also having sets count on every set… Can you delete all sets? What’s the count then? Don’t see how I can restore default set, so not too brave to test it I guess then you can’t get count at all, because there are no sets
Yes, that is what I meant. But check what happens if you have exactly one actionSet or none. Just to be sure I would expect this to fail when there is none.
Don’t know. Would need to revisit and test if DOM has improved, but I believe BP is still the closest to Ps internals, that we have access to, so it should be faster anyway