Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
  • 한국 커뮤니티
0

Adobe Bridge script - Download images from a URL link to a folder path with a Cyrillic name

Community Beginner ,
Dec 04, 2020 Dec 04, 2020

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:

2020-12-04.png

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"

 

2020-12-04-2.png

Adobe Bridge passes incorrect path. How can this be fixed?

I am trying to embed it in a large script.

 

754
Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines

correct answers 1 Correct answer

Community Beginner , Dec 04, 2020 Dec 04, 2020

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)

...
Translate
LEGEND ,
Dec 04, 2020 Dec 04, 2020

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 04, 2020 Dec 04, 2020

I am using UTF-8 encoding. With this encoding, Adobe Script understands Cyrillic.

05.PNG

Bridge alert:

04.PNG

But when Bridge passes the path, I get the CMD error:

08.PNG

I checked all cyrillic encodings.

03.PNG

But Bridge doesn't understand them.

06.PNGCMD Error:07.PNG

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.

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Dec 04, 2020 Dec 04, 2020
LATEST

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)

Translate
Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines