Scripting: directory renaming: error, when more than 15 dir-entries loaded

Advanced Renamer forum
#1 : 30/03-13 16:10
NomenEtOmen
NomenEtOmen
Posts: 29
hi,

here a more severe problem: i change dir-names with a script (see p.s.) when more than 15 directories are loaded in the work area, the renaming also in the preview fails. if i load the directories in packages smaller than 16, every renaming runs proper.
maybe an index or overflow problem?

ciao

p.s. here my script:


/**
list of words: last word to front, separated with ,
words words word -> word, words words
**/
var oName = item.name; //original name
var nName = "" ; //new name
var last = "" ; //ast word
var help = "" ;
var sSep = "," ; //the separator after first word

//processing error when name contains .
//masquing: mask . with other char: ~
var bMasquing = 0; //masquing on off
if (bMasquing && oName.indexOf(".")>=0){
oName = oName.replace(/\./g,"~");
}

var bSeparatorDetection = 1;
if (bSeparatorDetection && oName.indexOf(sSep)>=0){
return; //de-activate renaming for .
}


//algorithm selection
var algorithm = "split" ; //substr extract with substr-technology
//split use split and rebuild
if (algorithm=="substr"){
/* substr-index-variante */
var nLastIndex = oName.lastIndexOf(" ");
if (nLastIndex<=0) {
//no space found
return;
}
last = oName.substring(nLastIndex);
nName = last + sSep + " " + oName.substr(0,nLastIndex);


} else if (algorithm=="split"){
/* split-variante */
var comp = oName.split(" ");
if (comp.length<=1) {
//no spliting
return;
}
//it has splitted :-)
last = comp.pop() + sSep;
comp.unshift(last);
nName = comp.join(" ");

} else {
//unsigned algorithm -> error
return;
}

//de-masking . with ~
if (bMasquing && nName.indexOf("~")>=0){
nName = nName.replace(/~/g,".");
}

//script-end: new name
return nName;

----------
neo


30/03-13 16:10 - edited 30/03-13 16:21
#2 : 28/04-13 15:38
NomenEtOmen
NomenEtOmen
Posts: 29
Reply to #1:
with the new version this problem seems to be vanished.

thx

----------
neo


28/04-13 15:38
#3 : 02/05-13 19:39
Kim Jensen
Kim Jensen
Administrator
Posts: 775
Reply to #2:
I am glad to hear that. With the latest release the scripting method has become much more stable and reliable.


02/05-13 19:39