Is it possible to auto update InDesign script from cloud?
Copy link to clipboard
Copied
Hi All,
Is it possible to update a script from the cloud once there is a difference in the size of the script?
Thanks,
Shonky
Copy link to clipboard
Copied
Hi,
Kris here. I just tried it out on an M1 Mac with Big Sur and it seems to work fine. However, do note that it won't work unless you run InDesign in Rosetta. I'd need to make a new version that also supports M1. It is on the back burner until I get through my to-do-list for paying customers, which means it might be a long time before I get to it. So, for now, if you're on an M1 Mac, you need to run it with Rosetta.
Copy link to clipboard
Copied
Thanks but I am on Intel iMac and not on M1.
Copy link to clipboard
Copied
Another idea:
on a mac you can run terminal commands via doScript().
So you probably simply could implement a curl or wget command within a InDesign startup script which downloads the current script file on InDesign startup.
I guess you need to download it anyway to compare it, so I would just replace it, even if there is no change.
Copy link to clipboard
Copied
Thanks Jens but need a solution for Mac and Windows.
Copy link to clipboard
Copied
Your startup script could include both Applescript (Mac) and VisualBasic (PC) commands to execute depending on the environment the startup script is executing in.
Copy link to clipboard
Copied
It is possible using ExtendScript's socket object, which works fine (http only, though, not https).
You have to create a new Socket object, set the headers correctly, and it's always best to download everything as binary data, so set the encoding to binary.
At this point, you should be able to download what you need and save the downloaded data as a new script file overwriting the previous one.
Ariel
Copy link to clipboard
Copied
Thanks Ariel! Do you have some sample code?
Copy link to clipboard
Copied
Sure, something like this (based on Adobe's JavsScript Tools Guide pdf):
reply = "";
conn = new Socket;
// access msn home page
if (conn.open ("www.msn.com:80")) {
// send a HTTP GET request
conn.write ("GET /msn.com/ HTTP/1.0\r\n" + "Host: www.msn.com\r\n\r\n");
// and read the server’s reply
reply = conn.read(999999);
conn.close();
}
alert(reply);
Copy link to clipboard
Copied
Reply is blank, I tried Adobe as well but not receiving any output.
Copy link to clipboard
Copied
Blank is the correct result. You do need to understand the basics of the HTTP protocol. There is no page at www.msn.com/msn.com, so you should see an error returned, however, the script does not check for one. Just use the script as a starting point, copy/paste is not enough.
Copy link to clipboard
Copied
Hi @Shonkyin1,
As I already mentioned if you go by the route that Ariel mentioned you need to understand the nitty-gritty of HTTP protocol, there is no magic bullet here that you can just use and get your job done. The facts remain the same
- ESTK does not have any implementation for HTTP/HTTPS calls. You just have a socket object to start with.
- You could use the C++ DLL/framework route of extending the capabilities of ESTK. A sample of this is Kris's solution that you tried.
- Create a C++ SDK plugin for InDesign
- Use Applescript/VBscript
- Or use a separate application written in something like NodeJS, Python and probably launch these applications from within jsx using something like File.execute method
-Manan
-
- 1
- 2