Are itemPaths exposed in UXP?

basically what is equivalent of app.activeDocument.pathItems in UXP?

1 Like

There is only low-level batch play code that could handle it right now and if you want to make your own DOM for paths then it is really difficult to make it right.

Hi Jarda,
Thanks for the reply.
Anyway to get list of paths and to target them would be fine with me.
possible to share some code or guide me in right direction.

using batch play, i understand, we can only ‘select this path’ or ‘select that path’. However i would like to know all paths and target/select them and loop through them. Possible?

Thanks in advance

You have to get number of paths in document which is property. Then you iterate paths by index reference. But a good practice is to reference items by ID so you might want to get ID by index reference and then use ID in reference.

But the most funny part is that with vector masks… number of paths in document will change based on selected layers with vector paths.

Vector path has property “kind” indicating what kind of path it is but if vector path mask is selected then it is “vectorMask” and if it is not selected then it is “normalPath” making this property useless.

So you have to iterate all selected layers and get their vector mask with reference containing layer + path with vector mask enum and then compare IDs and then you can finally exclude it from list.

Enjoy!

How do i get that? if in CEP i know app.activeDocument.pathItems.length.

How do i get count of paths and their names etc?

Secondly, your answer is too advance for me and in my use case, layers are not a problem. We start with just 1 layer and n number of paths. No Vector mask or anything like that.

I need to create different layers based on paths and their content.

Thanks in advance

I understand we need to get the paths info from the layers
Will give this a try.
Thanks

The same problem I encountered

Which one? Paths or vector masks? Paths are already in DOM so it is easy now. https://developer.adobe.com/photoshop/uxp/2022/ps_reference/classes/pathitem/

1 Like