Copy link to clipboard
Copied
Hi All,
I have curl command. For example, curl google.com . Now, I want the command to execute inside JSX script and the script is already running in InDesign application.
I tried to using app.system("curl google.com"). It doesn't work.
Please give any alternate idea to executing this.
Thanks.
1 Correct answer
Hi @AD4003 , Here’s an OSX example, gets my local weather:
var tp = "~/Desktop/NewburyportWeather.txt"
var nbptWeather = 'tell application id "com.adobe.indesign"\rset nw to do shell script "curl https://api.weather.gov/gridpoints/BOX/73,98/forecast/hourly"\rdo shell script "echo " & quoted form of nw & " > ~/Desktop/NewburyportWeather.txt"\rend tell';
$.writeln( nbptWeather.toString());
app.doScript(nbptWeather, ScriptLanguage.applescriptLanguage);
var myWeather = readFile(tp)
alert(myWe
...
Copy link to clipboard
Copied
Hi @AD4003,
Not much is available nattvely in ExtendScript. See the following discussion for details
You could also try using Applescript on a MAC and VBScript on WIN via the app.doScript method.
-Manan
Copy link to clipboard
Copied
"I tried to using app.system("curl google.com"). It doesn't work."
That should work with PhotoShop on MacOS. Never tried on Windows 10.
InDesign does not have the system() method on app.
Look into this thread:
Let us know how it goes.
Also look into Marc Autret's framework IdExtenso:
https://github.com/indiscripts/IdExtenso
https://github.com/indiscripts/IdExtenso/blob/master/etc/$$.Web.jsxlib
Regards,
Uwe Laubender
( Adobe Community Professional )
Copy link to clipboard
Copied
Hi @AD4003 , Here’s an OSX example, gets my local weather:
var tp = "~/Desktop/NewburyportWeather.txt"
var nbptWeather = 'tell application id "com.adobe.indesign"\rset nw to do shell script "curl https://api.weather.gov/gridpoints/BOX/73,98/forecast/hourly"\rdo shell script "echo " & quoted form of nw & " > ~/Desktop/NewburyportWeather.txt"\rend tell';
$.writeln( nbptWeather.toString());
app.doScript(nbptWeather, ScriptLanguage.applescriptLanguage);
var myWeather = readFile(tp)
alert(myWeather)
function readFile(p) {
var f = new File(p);
f.open("r");
var x = f.read();
f.close();
return x; //returns the text
}

