Highlighted

Import function from external script JavaScript

Community Beginner ,
Jun 08, 2020

Copy link to clipboard

Copied

Hi, everyone!

I'm quite new to scripting in Illustrator, so I was wondering whether I could write a file with a few funcitons that I use most often (like utilities in python) and call them from this file into a different script instead of writing them every time. Like that:

```

// internal_file.js

from external_file import Function

```

Unfortunately, I was unable to do it with the standard js methods and I suppose, it's because Illustrator scripting uses a basic version of js that doesn't have all the methods and objects. Has anyone found a way around?

Adobe Community Professional
Correct answer by Charu Rajput | Adobe Community Professional

Hi, you can include external scripts uisng the following commands

#include "fileName"

 Example :

#include "utility.jsx"

 

Let us know if you are looking for this or something else.

 

 

Topics

How to, Import and export, Scripting, Third party plugins

Views

354

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

Import function from external script JavaScript

Community Beginner ,
Jun 08, 2020

Copy link to clipboard

Copied

Hi, everyone!

I'm quite new to scripting in Illustrator, so I was wondering whether I could write a file with a few funcitons that I use most often (like utilities in python) and call them from this file into a different script instead of writing them every time. Like that:

```

// internal_file.js

from external_file import Function

```

Unfortunately, I was unable to do it with the standard js methods and I suppose, it's because Illustrator scripting uses a basic version of js that doesn't have all the methods and objects. Has anyone found a way around?

Adobe Community Professional
Correct answer by Charu Rajput | Adobe Community Professional

Hi, you can include external scripts uisng the following commands

#include "fileName"

 Example :

#include "utility.jsx"

 

Let us know if you are looking for this or something else.

 

 

Topics

How to, Import and export, Scripting, Third party plugins

Views

355

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
Jun 08, 2020 0
Adobe Community Professional ,
Jun 08, 2020

Copy link to clipboard

Copied

Hi, you can include external scripts uisng the following commands

#include "fileName"

 Example :

#include "utility.jsx"

 

Let us know if you are looking for this or something else.

 

 

Best regards

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
Reply
Loading...
Jun 08, 2020 1
Anna41 LATEST
Community Beginner ,
Jun 08, 2020

Copy link to clipboard

Copied

It worked, thanks a lot!

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
Reply
Loading...
Jun 08, 2020 1