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

Using external Library in extendedscript

New Here ,
Jul 06, 2023 Jul 06, 2023

Copy link to clipboard

Copied

Can I use an external library such as markerjs to add annotations in a created layer using extendedscript?. If yes can you point me to the documention where I can get a gist of how to implement it.

TOPICS
Scripting

Views

509

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

correct answers 1 Correct answer

Community Expert , Jul 07, 2023 Jul 07, 2023

Also, the included code would have to be written with the InDesign ExtendScript API, so I don’t think the web markerjs library you linked to is going to work with Adobe apps.

Votes

Translate

Translate
Community Expert ,
Jul 07, 2023 Jul 07, 2023

Copy link to clipboard

Copied

Hi @parthivs86032685 , Try using the .jsxinc extension for the external file and save it to the same directory as the script that includes the .jsxinc file. Then at the top of your script ad #include "YourLibName.jsxinc". For eample this for external code named HelloWorld.jsxinc:

 

 

 

/**
* External function example saved with .jsxinc in the same directory as script 
* @ param s string
* @ return new string 
*/

function helloWorld(s){
  return "From Hello World: " + s
}

 

 

 

And in the same directory a script calling the helloWorld() method from the .jsxinc file:

 

 

 

#include "HelloWorld.jsxinc"

alert(helloWorld("Hi There!"))

 

 

 

Run from ID:

 

Screen Shot 22.png

Votes

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 Expert ,
Jul 07, 2023 Jul 07, 2023

Copy link to clipboard

Copied

Hi @rob day,

Any specific reason to use the jsxinc extension, I think any extension would work like jsx and js.

@parthivs86032685 as mentioned previously, you can use any external library you want the only cavaet being that it is compatible with the ECMAScript 3 as this is what extendscript uses.

-Manan

Votes

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 Expert ,
Jul 08, 2023 Jul 08, 2023

Copy link to clipboard

Copied

Hi Manan, I did not check if .jsx will also work, but there’s this reference

 

https://extendscript.docsforadobe.dev/extendscript-tools-features/preprocessor-directives.html

 

Votes

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 Expert ,
Jul 08, 2023 Jul 08, 2023

Copy link to clipboard

Copied

LATEST

That's what that document says, but in fact, as Maman mentioned, it can be any file extension.

Votes

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 Expert ,
Jul 07, 2023 Jul 07, 2023

Copy link to clipboard

Copied

Also, the included code would have to be written with the InDesign ExtendScript API, so I don’t think the web markerjs library you linked to is going to work with Adobe apps.

Votes

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
LEGEND ,
Jul 07, 2023 Jul 07, 2023

Copy link to clipboard

Copied

"Add image annotation functionality to your web apps with the ultimate image annotation library - marker.js 2." - so absolutely not. 

Votes

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