Skip to main content
Participating Frequently
May 9, 2022
Question

Event listener in illustrator

  • May 9, 2022
  • 2 replies
  • 874 views
We have many errors for several eps files and have written several scripts to work properly with manual execution. But some eps files have no errors.

How to write if there is an error on the open illustrator document.

This topic has been closed for replies.

2 replies

femkeblanco
Legend
May 9, 2022

There is no global onError event handler or "error" event listener which will do what I think you want.

Participating Frequently
May 10, 2022

Thanks femkeblanco,

Kindly help me if the illustrator has addEventListener method for javascript.

pixxxelschubser
Community Expert
Community Expert
May 9, 2022

Sorry @javithj89048510

 

Please imagine that you do not know how these files were created and how they are structured. And please also imagine that you do not know what the scripts do (or should do), how and in which script language they are written, nor what error messages there are or are not. You know neither the Illustrator version nor the operating system.

 

Please read your post again from this point of view.

Silly-V
Legend
May 9, 2022

I suggest this solution: use the try-catch statement to wrap the script!

 

try {

  function myScript () {

    throw new Error("It was a failed script :(");

  }

  myScript();

} catch (e) {

  alert(e.message);

}

Participating Frequently
May 10, 2022

Thanks Silly-V

Kindly help me if illustrator have addEventListener method for javascript