Skip to main content
Participant
December 4, 2020
解決済み

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

  • December 4, 2020
  • 返信数 2.
  • 734 ビュー

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.

 

    このトピックへの返信は締め切られました。
    解決に役立った回答 sergeyv8093394

    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)

    返信数 2

    sergeyv8093394作成者解決!
    Participant
    December 4, 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) and downloaded with powershell (use-powershell-to-download-a-file)

    Legend
    December 4, 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.

    Participant
    December 4, 2020

    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.