Copy link to clipboard
Copied
Is there a way to be notified when the selected layer is changed for an open document in InDesign CC (2014)?
I'd like to use this event in a CC (HTML) extension.
InDesign_ScriptingGuide_JS.pdf / "Adobe InDesign CS6 JavaScript Scripting Guide" (page 134) suggests that one should view available events in the Object Model Viewer, by selecting
"Event" in the Classes list, and "Class" in the Types list. Well... there I get a list of all events, but nothing about which objects they belong to.
However, it seems that the only objects that can raise these events are the ones that also have an XxxxEvent class (where Xxxx is the class name of the object):
DocumentEvent
IdleEvent
ImportExportEvent
MutationEvent
PrintEvent
No layer object there. Any suggestions on how to check for LayerChanged, or how to make something similar?
Thanks,
Andreas
Copy link to clipboard
Copied
Hi Andreas,
I don't think there is a layer related event. There is a afterSelectionChanged Event but I am not sure it would be raised after changing layer selection.
On last resort, I used to create timer loops in AS3 to check those kind of stuffs. I didn't mak any html extensions so far but I guess it's doable.
FWIW,
Loic
Copy link to clipboard
Copied
Thanks, I will probably not use events for this when there is no actual layer changed event.
At least I'll try another way first – it would just have been convenient to always have access to the correct layer name.
And by the way, ignore the bold lines in my message above, there are lots of classes with events presented on them, that do not have a class XxxxEvent.
Copy link to clipboard
Copied
Hi,
…always have access to the correct layer name.
But why not use the activeLayer property of the LayoutWindow ?
app.activeDocument.layoutWindows[0].activeLayer.name
So you can retrieve active layer name at any time, don't you ?
Loic
Copy link to clipboard
Copied
It was in the HTML user interface that I wanted access to the layer name, and its only communication with InDesign is via function calls (asynchronous) and events.
But I did make a call from the HTML/js interface to get the active layername from InDesign, and with that I could go on making another call to a database that needed the layer name. So it's working ok.
Copy link to clipboard
Copied
Find more inspiration, events, and resources on the new Adobe Community
Explore Now