Help with adjusting Indesign script
Hi,
I need some help adjusting this code. It almost does what i need to have. It outputs a folder with images to a CSV file where it shows the path to every image and the filename and extention.
What i need is the same but then without the extention to the name.
Anyone have any knowledge of this kind of code and knows what i need to adjust to get it to work my way? I tried a few things but i can't find out what i need to change.
I would very much appreciate it.
Array.prototype.inArray = function(obj){
var arrMax = this.length-1;
for(var i=arrMax; i>=0; i--){
if(this[i]===obj){
return true;
}
}
return false;
}
var csvParser = (function(){
var csvFile;
return{
create:function(fo){
csvFile=File(fo+"/"+fo.name+".csv");
},
write:function(csvContent){
csvFile.open('w');
csvFile.encoding="UTF-8";
csvFile.write(csvContent);
csvFile.close();
},
execute:function(){
csvFile.execute();
},
getCSV:function(){
return csvFile;
}
}
})();
function imagesToCSVthenChoose(){
var doc,
fo,
fis,
fiMax,
fi,
fiName,
fiPath,
imgFormats=["eps","jpg","tif","psd","pdf","png","ai","bmp","jpeg"],
imgFormatMax = imgFormats.length-1,
imgOk = [],
csvContent = [],
csvLine=[],
csvSep=",";
if(app.documents.length==0){
alert("No documents open !");
return
}
doc=app.activeDocument;
fo = Folder.selectDialog("Please choose a folder with images");
if(!fo) return
fis = fo.getFiles();
fiMax=fis.length;
for(var i=0; i<fiMax; i++){
fi=fis[i];
ext = fi.name.match(/\.([a-z]+)$/i);
if(ext==null) continue;
ext = ext[1].toLowerCase();
if(!imgFormats.inArray(ext)) continue;
fiName = decodeURI(fi.name);
