I have this code which generates an array of information on where the guidelines are set in any Photoshop document.
var guides = app.activeDocument.guides;// get the current doc s guides
var guideArray = [];
for (var g = 0; g < guides.length; g++){
guideArray.push( [guides[g].direction, guides[g].coordinate ]);// store the guide properties for later
}
prompt("title", guideArray);
And the prompt gives this output:
Direction.VERTICAL,47 px,Direction.VERTICAL,240 px,Direction.VERTICAL,182 px,Direction.VERTICAL,351 px,Direction.VERTICAL,119 px,Direction.VERTICAL,21 px,Direction.HORIZONTAL,89 px,Direction.HORIZONTAL,199 px,Direction.HORIZONTAL,54 px,Direction.HORIZONTAL,171 px
I want to split this array with by adding this code
var b = [];
for (var i = 0; i < guideArray.length; i++){
var b = guideArray[i].split(",");
}
which gives me this error,
exceptionMessage([Error:ReferenceError: guideArray[i].split is not a function])
Why?
Ignoring purpose of what I m doing (already figured it out in a more elegant manner), I am curious to know why this is failing.
I m really curious because I tried this and it works,
var guides = app.activeDocument.guides;// get the current doc s guides
var guideArray = [];
for (var g = 0; g < guides.length; g++){
guideArray.push( [guides[g].direction, guides[g].coordinate ]);// store the guide properties for later
}
var guideString = guideArray.toString();
var b = guideString.split("x,");
for (var i = 0; i < b.length; i++){
var c = b[i].split(",");
}
alert(c[1]);
And this works, even though I am doing seemingly the same thing with split in the for loop as above.