https://github.com/ff6347/extendscript-call-system
explore how to download files and data from the web with extendscript on Windows and macOS
https://github.com/ff6347/extendscript-call-system
Last synced: about 1 year ago
JSON representation
explore how to download files and data from the web with extendscript on Windows and macOS
- Host: GitHub
- URL: https://github.com/ff6347/extendscript-call-system
- Owner: ff6347
- License: other
- Created: 2017-04-11T12:32:50.000Z (about 9 years ago)
- Default Branch: master
- Last Pushed: 2024-03-02T14:31:03.000Z (over 2 years ago)
- Last Synced: 2025-01-24T18:35:24.037Z (over 1 year ago)
- Language: Shell
- Size: 46.9 KB
- Stars: 2
- Watchers: 1
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
Extendscript Call System
========================
Exploration on how to call system commands from extendscript. Mainly for InDesign.
----
Dear all. I think this was already discussed several times but I can't find any good example around the web. How do you execute system commands on windows? On macOS we use (in Basil.js) these snippets:
Snippet 1:
var cmd = "pwd";
app.doScript("return do shell script item 1 of arguments", ScriptLanguage.applescriptLanguage, [cmd]);
And to make a call to an URL over HTTP/s this one:
Snippet 2:
var url = "https://api.github.com/orgs/basiljs/repos"
var cmd = "curl -m 15 -L '" + url + "'";
app.doScript("return do shell script item 1 of arguments", ScriptLanguage.applescriptLanguage, [cmd]);
Last this is our call to download a file from the web.
Snippet 3 (shell script):
#!/bin/bash
mkdir -p "$1"
cd "$1"
if [ -z "$3" ]
then
curl -L -O "$2"
else
curl -L -o "$3" "$2"
fi
Snippet 4 (extendscript):
var url = 'http://fabianmoronzirfas.me/assets/images/avatar/avatar-0.JPG';
var cmd = 'sh /Users/icke/tmp/download/download.sh /Users/icke/tmp/download/bin/ ' + url;
app.doScript('return do shell script item 1 of arguments', ScriptLanguage.applescriptLanguage, [cmd]);
Has anybody an equivalent for snippet 1 + 4 for windows?