Copy link to clipboard
Copied
I am trying to download images from a URL link to a folder path with a Cyrillic name using Adobe Bridge scripting.
Example:
var localImgPath = 'C:/Users/serge/Desktop/Привіт світ/new-img.png';
var imageUrl = 'https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikipedia-logo-v2.png';
app.system('curl -o "' + localImgPath + '" "' + imageUrl + '" pause');
Error:
But if the path to the saved file is entirely in Latin, the file is successfully saved. And if I write a cmd line with a Cyrillic path, it also works.
curl -o "C:/Users/serge/Desktop/Привіт світ/new-img.png" "https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikipedia-logo-v2.png"
Adobe Bridge passes incorrect path. How can this be fixed?
I am trying to embed it in a large script.
I found a solution and I will answer my own question myself. Wonderful resource)
var localImgPath = encodeURI('C:/Users/serge/Desktop/Привіт світ/new-img.png');
var imageUrl = 'https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikipedia-logo-v2.png';
app.system("powershell -nop -c $mypath = [Uri]::UnescapeDataString('" + localImgPath + "'); Invoke-WebRequest -Uri '" + imageUrl + "' -OutFile $mypath");I encoded the path with Cyrillic (encodeURI) and decoded back in powershell (escaping-text-strings)
...Copy link to clipboard
Copied
I suspect you may get more replies in the Bridge forum if the fault happens in Bridge scripting. When you post, be sure to say what encoding you use when saving the script file.
Copy link to clipboard
Copied
I am using UTF-8 encoding. With this encoding, Adobe Script understands Cyrillic.
Bridge alert:
But when Bridge passes the path, I get the CMD error:
I checked all cyrillic encodings.
But Bridge doesn't understand them.
CMD Error:
Perhaps I can save the file to a temporary path with Latin letters and then move it using the Adobe script, but I hope there is a solution to this problem.
Copy link to clipboard
Copied
I found a solution and I will answer my own question myself. Wonderful resource)
var localImgPath = encodeURI('C:/Users/serge/Desktop/Привіт світ/new-img.png');
var imageUrl = 'https://www.wikipedia.org/portal/wikipedia.org/assets/img/Wikipedia-logo-v2.png';
app.system("powershell -nop -c $mypath = [Uri]::UnescapeDataString('" + localImgPath + "'); Invoke-WebRequest -Uri '" + imageUrl + "' -OutFile $mypath");I encoded the path with Cyrillic (encodeURI) and decoded back in powershell (escaping-text-strings) and downloaded with powershell (use-powershell-to-download-a-file)
Get ready! An upgraded Adobe Community experience is coming in January.
Learn more