To execute a script in ES, and be woken by the callback when it is done. In JS you have a ‘CSInterface’ thingy and you can call sumtin’ like One thing that always annoyed me a bit was the asymmetrical nature of the interface between JS and ES. Lots more info about all this can be found here: you can run multiple extensions concurrently), whereas the ES environment is a single-tasking shared resource: when an operation is launched from any of the active JS environments in ES, the ES environment gets busy in mumble mode, and any subsequent ES operation request from any other JS will stall until the previous ES operation is finished. To compound the issue, the JS environment provides multiple independent runtimes (i.e. Instead, there is a ‘callback’-based interface. From the JS environment, one can initiate some operation in the ES environment. When the ES environment completes the task, it calls back to the JS environment with the results. The ES and JS environments are quite separate, and run independently of one another. The JavaScript (JS) programming environment is ‘outward facing’: it can drive user-interfaces that are contained within floating panels and dialog boxes.īecause the JS environment has a complete Node.js available, writing things like an https-capable GetURL replacement is trivial on the JS side.īut that is not a proper solution for the ExtendScripter. The ExtendScript (ES) programming environment is ‘inward facing’: it is tightly integrated with InDesign and can interact with the InDesign Document Object Model (DOM). These environments share very similar languages (ExtendScript and JavaScript), which is often a bit confusing. "(JSInterface.getData())",įor a while now, InDesign and other Creative Cloud apps have been including the Adobe Common Extensibility Platform (CEP) and Extensions.Įssentially, an Extension is akin to a browser (Chrome) with a server (Node.js) all rolled into one, all running as an ancillary process inside of InDesign.Īs a result, an InDesign scripter now has two totally separate programming environments at their disposal. JSInterface.evalScript("console.log('hello') ") In the following post, I’ll show a solution that allows the ExtendScript coder to write something as simple as #targetengine TestSomewhere I will probably be tweaking this for some time to come, but it currently works fairly well as-is, so for people in need, they can grab what I have, as-is, and try to make sense of it. What I am presenting here is ‘work-in-progress’, or maybe better ‘mucking-around-in-progress’. So, I decided to find a different solution. Sadly enough, crusty old GetURL.jsx is not up to the task: for efficient HTTPS support, things get a lot more complicated.ĭoing it all in pure ExtendScript would be nearly certainly too slow. Recently, more and more people started asking me for HTTPS support. Over time, I added a few little tweaks to help people out, but by now GetURL.jsx must be a contender for the longest living stopgap measure ever. It was not very fast, and could not handle many HTTP features. It was never intended to be a full HTTP socket implementation, but in the end, it turned out that the sample served a purpose for many people, as it allowed them to interact with HTTP-based services from ExtendScript. On a whim, I decided to implement a bit of the HTTP protocol in ExtendScript and InDesign. Note 1: Latest installer which also supports InDesign 2020 and macOS Catalina:Ī long, long time ago, I wrote a bit of sample code to demonstrate state machines. Not just for InDesign – any Adobe app that supports ExtendScript can use this. Note : Make sure to check out my novel approach to GetURL: making curl available in ExtendScript.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |