BUG for script-method(?): item.filesInDir only when multiple directories

Advanced Renamer forum
#1 : 15/05-22 17:30
russa
Posts: 2
I have finally tried the script-method for renaming and it is a very powerful tool indeed :-)

However, I think, I encountered a BUG in the script-method for the item.filesInDir field:

when there are files from multiple directories in the rename-list, the value for item.filesInDir only seems to be set for the first directory, and for the other directories item.filesInDir has a value of 0 (zero)

(I did not check items.dirsInDir, but it may have a similar problem)


And as a suggestion for the docs:
it took me a while to discover that all fields of the item-object can be viewed with the autocomplete feature of the editor.
I think it would be good to mention in the user guide that there is an autocomplete feature for the script-editor -- and maybe even illustrate it in the example screenshot.
#2 : 15/05-22 23:37
David Lee
Posts: 1125
Are you sure that you didn't use items.dirsInDir by mistake?

the code:

"return item.filesInDir + "-" + item.name;"

works perfectly for me even with nested directories
#3 : 16/05-22 20:40
russa
Posts: 2
Reply to #2:

yes sorry, you are completely right:

I worked with the wrong assumption that the index-parameter would refer the "index within the directory", but of course it's the index within the complete renaming-list