Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

JS/CC: Event upon layer change, possible?

Enthusiast ,
Jan 22, 2015 Jan 22, 2015

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

TOPICS
Scripting
643
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jan 22, 2015 Jan 22, 2015

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

http://www.ozalto.com

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Jan 23, 2015 Jan 23, 2015

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Jan 23, 2015 Jan 23, 2015

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

http://www.ozlto.com

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Enthusiast ,
Feb 02, 2015 Feb 02, 2015

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
People's Champ ,
Feb 02, 2015 Feb 02, 2015
LATEST

Cool. Glad it helped somehow.

Loic

http://www.ozalto.com

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines