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?
use decodeURI
Copy link to clipboard
Copied
use decodeURI
Copy link to clipboard
Copied
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)
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
for ( var o = 0; o < linkChecker.length; o++ ) {
for ( s = 0; s < mSelected.length; s++ ) {
if (linkChecker
$.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
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)
Copy link to clipboard
Copied
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