1

I am developing an extension for InDesign and I would like to store the jsx file on a server. This would allow me to update the plugin if I change something in the jsx without the user having to re-download the extension. I tried to directly do an include in the jsx that is mentioned in the manifest to try to point to the real jsx like this:

local-index.jsx :

//@include "https://server-name/adobe/addins/extendscript/server-index.jsx"
  • (local-index would only serve as a bridge between JavaScript and ExtendScript)
  • (server-index would contain all the methods I use on the JavaScript side with CSInterface.evalScript();)

It doesn't work and I couldn't find any information on the web. Is it possible or does the jsx file have to be local ?

Thanks in advance !

Fitspade
  • 377
  • 1
  • 11
  • 1
    As far as I know you can run/link jsx scripts from any folders that your OS able to resolve like local folders. So, yes, probably you can't directly link from 'http://...' address. It's need to mount it as a local folder/drive first. Something like this. I'm running my scripts from my local network (`//my_server/scripts/my_script.jsx`) exactly because of the same reason -- to keep the updated scripts in one place. Perhaps you can mount your external resource to a local machine with a cmd/bat/bash file (which can be fired from jsx script via `.execute()` method) – Yuri Khristich Jan 25 '22 at 21:02
  • Thanks @Yuri, I'll look into implementing this ! – Fitspade Feb 10 '22 at 13:25

1 Answers1

0

You can make AJAX request in local JS to retrieve JSX string from server
See example below

Server side PHP code be like:

<?php
    //JSX Code
    echo 
    "
    alert ('Hello From Server');
    file = new File('~/Desktop/fromServer.txt');
    file.open('w');
    file.write('Hi');
    file.close();
    ";
    
    //OR JSXBIN Code
    //Use eval and remove line breaks from JSXBIN String
    echo "eval('@JSXBIN@ES@2.0@MyBbyBn0AFJAnA.....')"; 
?>

JS code client side:

$.ajax({
        type: "GET",
        cache:false,
        url: URL,
        complete: function (Res) {
          scr = Res.responseText;
          csInterface.evalScript(scr);
        },
        async: false //For Synchronous Excecution 
      });