Skip to main content
Participant
July 7, 2023
Answered

Using external Library in extendedscript

  • July 7, 2023
  • 3 replies
  • 990 views

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.

This topic has been closed for replies.
Correct answer rob day

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.

3 replies

Legend
July 7, 2023

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

rob day
Community Expert
rob dayCommunity ExpertCorrect answer
Community Expert
July 7, 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.

rob day
Community Expert
Community Expert
July 7, 2023

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:

 

Community Expert
July 8, 2023

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

-Manan
rob day
Community Expert
Community Expert
July 8, 2023

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