Author Topic: Search Filename as String of results.analysis.files [0]  (Read 46 times)

icqtoni

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Hi, I'm new here.
I know something about javascript ... but here i just can not get any further. I would like to export the quality analysis of my collection. Here I fail at this point:

var files = results.analysis.files;
for (var idx = 0; idx < files.length; ++idx) {

   //var filename = "D:\\path\\file.mp3";
   var filename = files[idx]; // Filename as String ???

   var tmp = filename.lastIndexOf("\\");

If I manually set a string this will work.
Now it fails at lastIndexOf.

I hope I can still be helped.

Thanks in advance
icqtoni

Admin

  • Administrator
  • Hero Member
  • *****
  • Posts: 649
    • View Profile
    • http://www.smilarityapp.com
Re: Search Filename as String of results.analysis.files [0]
« Reply #1 on: September 11, 2019, 20:00:15 »
Sorry for the delay.
your filename is not a string, it's special object, just get path property and it is a string.

Code: [Select]
var files = results.analysis.files;
for (var idx = 0; idx < files.length; ++idx) {

   //var filename = "D:\\path\\file.mp3";
   var filename = files[idx].path; // Filename as String ???
   var or_get_filename = files[idx].filename; // Filename as String ???

   var tmp = filename.lastIndexOf("\\");

   log(filename + ': ' + tmp);
}

icqtoni

  • Jr. Member
  • **
  • Posts: 3
    • View Profile
Re: Search Filename as String of results.analysis.files [0]
« Reply #2 on: September 18, 2019, 17:53:53 »
Hello Admin,

i had meanwhile recognized my mistake myself, nevertheless many thanks for your reference.
Great program that allows a real comparison of the files.

Best regards
icqtoni