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

delete %20 space character

New Here ,
Nov 10, 2016 Nov 10, 2016

Copy link to clipboard

Copied

Hello,

I've written a script which gives the user a list of links in the active document and returns the selected links in an array. It then searches a folder full of packaged INDD files and searches the links folders.

What I want to do is write an if statement that matches the two names.

However, the result of searching the folders puts %20 instead of a space so they never match.

How would I delete the %20 or add a %20 where there is a space character so that they match?

TOPICS
Scripting

Views

567

Translate

Translate

Report

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

Guide , Nov 10, 2016 Nov 10, 2016

use decodeURI

Votes

Translate

Translate
Guide ,
Nov 10, 2016 Nov 10, 2016

Copy link to clipboard

Copied

use decodeURI

Votes

Translate

Translate

Report

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
Guide ,
Nov 10, 2016 Nov 10, 2016

Copy link to clipboard

Copied

Votes

Translate

Translate

Report

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
Guide ,
Nov 10, 2016 Nov 10, 2016

Copy link to clipboard

Copied

For example..

var myFolder = File.openDialog("Select the Folder");

mydoc=app.documents[0];

if(myFolder!=null){FilePath=decodeURI(myFolder);}

alert(FilePath)

Votes

Translate

Translate

Report

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
New Here ,
Nov 10, 2016 Nov 10, 2016

Copy link to clipboard

Copied

myFiles = myFolder.getFiles();  //store the target files in a variable

for ( var i = 0; i < myFiles.length; i++ ) {
   
if (myFiles instanceof Folder ){
   
    var myFileLinks = myFiles.getFiles("Links");
   
    for ( var l = 0; l < myFileLinks.length; l++ ) {
   
    var linkChecker = myFileLinks.getFiles();
   
    for ( var o = 0; o < linkChecker.length; o++ ) {

        for ( s = 0; s < mSelected.length; s++ ) {
           
            if (linkChecker.decodeURI() === mSelected.name) {
               
                $.writeln("found it");
               
                        }else ("Didn't work")
                    }
                }
            }
        }
    }

This is what I have, the decodeURI doesn't seem to work where I have put it.

linkChecker.constructor.name returns file so it should work?

Votes

Translate

Translate

Report

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
Guide ,
Nov 10, 2016 Nov 10, 2016

Copy link to clipboard

Copied

Please give the code you used for myFolder... in your first line you called (myFiles = myFolder.getFiles();  //store the target files in a variable)

Votes

Translate

Translate

Report

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
New Here ,
Nov 10, 2016 Nov 10, 2016

Copy link to clipboard

Copied

LATEST

It's OK I got it working, I wasn't using it properly.

decodeURI(uri string)

I was using this as a property and not a function

Thanks

Votes

Translate

Translate

Report

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