Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Is it possible to call a web service with Indesign javascript?

I'm an in-house developer for a print company.

We use Adobe Indesign CS3 and CS5 to create documents for printing.

I created a script in Adobe Extendscript that creates an Indesign Document and handles some basic conversions when the client fails to do so themselves.

I used Javascript to write this script.

Is it possible to call a web service through such a script?

If so, how?

If not, what would be the best way to call a web service from the desktop?

Thank you.

like image 241
story Avatar asked Sep 27 '11 18:09

story


People also ask

How do I use JavaScript in InDesign?

To run the script, open a document in InDesign, then open the Scripts panel (see above) and double-click the script name. Some scripts require you make a selection first before you run them, because they act on the selection. See if the script writer provided any sort of documentation if you can't figure it out.

What is InDesign used for?

InDesign is the best choice to design and publish multipage documents containing text, vector artwork, and images. Use precise grids and guides to position page elements and create polished layouts. Take advantage of professional typesetting features to format text consistently across pages, chapters, and publications.


2 Answers

As of 2022 I would point to

  • Marc Autrets IdExtenso https://github.com/indiscripts/IdExtenso
  • My solution restix https://github.com/grefel/restix

Extendables was already mentioned (does not exist anymore):

Extendables

It is not jQuery, instead it is a library for InDesign Scripting.

The most complete discussion is found at Rorohiko's blog, with an nice straight forward example.

like image 147
grefel Avatar answered Oct 21 '22 11:10

grefel


No and Yes.

No, there is no way (afaik) to make InDesign call a web service from a script. It's very possible and often done from InDesign plugins (you can execute arbitrary c++ code so you can do whatever). However, that's an entirely different beast to learn.

Yes, it's possible to do from ExtendScript using a library. So basically your script would call the web service to get data (maybe using parameters gotten from InDesign or the document) and then send the returned values into other InDesign script functions to perform the operations.

A basic sample can be found here that uses 'Extendables'.

EDIT: Since there seem to be some confusion: The documents aren't the ones running the script and very rarely even contain them. The scripts are saved in an InDesign specific Javascript format (.jsx) and interpreted by the InDesign scripting engine.

like image 23
MatsT Avatar answered Oct 21 '22 10:10

MatsT