1

Typically when you're writing a .jsx script to automate an Adobe product (like InDesign, Illustrator or Photoshop), you write, debug and execute the script from the ExtendScript IDE. Is it possible to bypass ExtendScript and run the script from an third program?

I have written script to automate some work of after effects. i have been running the script from ExtendScript IDE, but now i want user to give input arguments from a html form and then when he clicks submit button, i want to pass the user input to jsx script and then automatically run the script.

So basically I want to call jsx code from HTML or JavaScript code written in html file

Mark Amery
  • 143,130
  • 81
  • 406
  • 459
pratik_z
  • 65
  • 1
  • 1
  • 5

2 Answers2

0

That's tricky but it might be achieved if you don't consider that the html page will run the script but rather if the script is looking for some setup to appear thanks to the html page.

If you are on mac, you could write an applescript to monitor a folder and run the jsx file when needed.

If you can afford to have InDesign frozen, consider using the $.sleep() to have it checking a folder regularly. ANother approach is to rely on AS3 in order to make InDesign available when nothing happens in the html side.

Last but not least, These are grey areas because scripts have to be user executed in the desktop version of adobe software. What you are trying to achieve is more about server script handling. Given your budget, you may have a look at the InDesign server solution. No server solutions for Ai & Ps though.

Hope it helps,

Loic

Loic Aigon
  • 506
  • 3
  • 1
  • The OP never mentioned the specifics, but he/she might be thinking HTML form that's hosted and executed client side rather than residing and executed server side. e.g. basically using client side HTML & JS to build a simple GUI for a script. Hopefully that is the case, easier for the OP to implement. – David Apr 15 '15 at 19:31
0

Yes, it's doable, but amount of effort depends on your platform. And what I present is a client side solution, as Loic mentioned, if you are aiming for a remote user to hit your webpage on a server to do this, that doesn't really work. You're better off building a web service that does all this and then have HTML form invoke the web service.

For HTML form case you will need to be on Windows, and you would execute the JSX code, providing the needed arguments/parameters from the form using either VBScript or javascript (via Microsoft JScript) code encapsulated within a script tag in the HTML file. The VB/JS code can be within the script tags or pulled in from an external VBS/JS file via the script tag. Using this solution, your HTML file has to be named with extension ".hta" not ".htm" or ".html". And you may want to add some additional HTA element tags to the file.

See this for details: http://en.wikipedia.org/wiki/HTML_Application

The benefit of HTA is that the browser security restrictions against local file system are removed unlike traditional HTML pages, so you get additional access like being able to use VBScript (rather than just javascript for HTML pages) and use COM objects. The trick here is we will use the Adobe app's COM API to execute the JSX file.

If on Mac, you don't have a similar equivalent I believe. Therefore, your alternative option is to build a GUI similar to an HTML form but is actually a desktop app for Mac (e.g. wxWidgets, Qt, native Mac app, Java GUI app). With that GUI built, it can execute the JSX via Applescript, since many languages (Java, Python, etc.) should have an Applescript bridge interface. Worst case, you could shell execute an Applescript passing it the arguments that the Applescript then passes to the actual JSX script file.

As for how to pass arguments to JSX file and execute it outside of ExtendScript IDE, see this SO post:

Is it possible to execute JSX scripts from outside ExtendScript?

What I just mentioned about HTML form or a GUI app is simply interfacing that to the SO post solutions.

Community
  • 1
  • 1
David
  • 3,223
  • 3
  • 29
  • 41