Skip to main content
Participant
December 11, 2013
Answered

Events in illustrator

  • December 11, 2013
  • 2 replies
  • 3998 views

I'm using the next code:

function onLoaded() {

    var csInterface = new CSInterface();

   

    csInterface.addEventListener("documentAfterActivate", onDocActivatedChanged); 

}

function onDocActivatedChanged(event) {

          new CSInterface().evalScript("$il._ext.callFunction()");

}

I have two questions:

- What other events can I use in illustrator?

- How can I use the event return var in the function onDocActivatedChanged?

Best Regards,

  vgcouso

    This topic has been closed for replies.
    Correct answer Zhihong Chen

    If I understand correctly, there is a “documentAfterSave” event, which was fired right after the document was saved. However, Iillustrator does not support this event.

    There is no document about this now, and we plan to add a part into cookbook later. “documentAfterActivate”, “documentAfterDeactivate” and “applicationActivate” are the three events supported by Illustrator now. An event may have “type”, “EventScope”, “appId”, “extensionId” and “data” properties, it depends on how the products like Illustrator assign the value.

    2 replies

    Participant
    December 12, 2013

    Please see my answers inline:

    - What other events can I use in illustrator?

    There are two other events sent by AI: documentAfterActivate and documentAfterDeactivate. The documentAfterActivate event fires when a document has been activated (after new/open document; or after document has retrieved focus). The documentAfterDeactivate event fired when the active document has been de-activated.

    - How can I use the event return var in the function onDocActivatedChanged?

    AI set two parameters in the event call back return value: event.type is “applicationActivate” and event.appId is “ILST”.

    Hope it helps!

    vgcousoAuthor
    Participant
    December 12, 2013

    Exist some event for when save and other?

    Where is documented event var?

    Zhihong ChenCorrect answer
    Participant
    December 12, 2013

    If I understand correctly, there is a “documentAfterSave” event, which was fired right after the document was saved. However, Iillustrator does not support this event.

    There is no document about this now, and we plan to add a part into cookbook later. “documentAfterActivate”, “documentAfterDeactivate” and “applicationActivate” are the three events supported by Illustrator now. An event may have “type”, “EventScope”, “appId”, “extensionId” and “data” properties, it depends on how the products like Illustrator assign the value.

    Zetta
    Known Participant
    December 11, 2013

    On the Illustrator Scripting Forums:

    http://forums.adobe.com/message/5920542#5920542

    does this help at all?