Event listener in illustrator

Community Beginner ,
May 09, 2022 May 09, 2022

Copy link to clipboard

Copied

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.

TOPICS
Scripting

Views

278

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
May 09, 2022 May 09, 2022

Copy link to clipboard

Copied

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.

Likes

Translate

Translate

Report

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
Adobe Community Professional ,
May 09, 2022 May 09, 2022

Copy link to clipboard

Copied

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);

}

Likes

Translate

Translate

Report

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
Community Beginner ,
May 10, 2022 May 10, 2022

Copy link to clipboard

Copied

Thanks Silly-V

Kindly help me if illustrator have addEventListener method for javascript

Likes

Translate

Translate

Report

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
Community Beginner ,
May 10, 2022 May 10, 2022

Copy link to clipboard

Copied

LATEST

 

Thanks pixxxelschubser

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

Likes

Translate

Translate

Report

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
Advocate ,
May 09, 2022 May 09, 2022

Copy link to clipboard

Copied

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

Likes

Translate

Translate

Report

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
Community Beginner ,
May 10, 2022 May 10, 2022

Copy link to clipboard

Copied

Thanks femkeblanco,

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

Likes

Translate

Translate

Report

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