Is there any way to read out CEP Event class?

Discussion of Photoshop Scripting, Photoshop Actions and Photoshop Automation in General

Moderators: Tom, Kukurykus

conny

Is there any way to read out CEP Event class?

Post by conny »

The return object from addEventListener does not seem to contain class? The only interesting property is 'data' and I can not make sense of what it actually contains.

Or is there perhaps a way to set the event to only listen to a certain class like you can with app.notifiers.add()?


What I want to do is catch the event for event "Mk " with class "ClSm".



Thanks!
undavide

Is there any way to read out CEP Event class?

Post by undavide »

conny

Is there any way to read out CEP Event class?

Post by conny »

Thank you Davide!

After a bit more digging the event.data property contains two values. First one is the eventid that I trigger on in the first place. The second one is a random number that never stays the same. No idea what it is...
Edit: See below for solution.
conny

Is there any way to read out CEP Event class?

Post by conny »

WOW! It worked! You are a hero!
conny

Is there any way to read out CEP Event class?

Post by conny »

To clarify if anyone reads this looking for the same solution. I took the second ID and ran it trough basically the same function you linked to:
var desc = new ActionDescriptor();
desc.fromID(id);
var idNull = charIDToTypeID('null');
var ref = desc.getReference(idNull);
var toolID = ref.getDesiredClass();
var stringID = typeIDToStringID(toolID);

id is the second parameter in event.data.