HISE Logo Forum
    • Categories
    • Register
    • Login

    Get list of midi files

    Scheduled Pinned Locked Moved Scripting
    19 Posts 3 Posters 779 Views
    Loading More Posts
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes
    Reply
    • Reply as topic
    Log in to reply
    This topic has been deleted. Only users with topic management privileges can see it.
    • d.healeyD
      d.healey
      last edited by

      filelist is an array of objects. So filelist[i] is an object not a string. Try Console.print(trace(filelist[i])); to see what is contained within your object.

      Free HISE Bootcamp Full Course for beginners.
      YouTube Channel - Public HISE tutorials
      My Patreon - HISE tutorials

      Dan KorneffD 1 Reply Last reply Reply Quote 0
      • Dan KorneffD
        Dan Korneff @d.healey
        last edited by

        @d-healey said in Get list of midi files:

        Console.print(trace(filelist[i]));

        It returns

        Interface: undefined
        

        Dan Korneff - Producer / Mixer / Audio Nerd

        d.healeyD 1 Reply Last reply Reply Quote 0
        • d.healeyD
          d.healey @Dan Korneff
          last edited by

          @dustbro If you're going to copy and paste things that I write you should check that I've written it correctly ;) Your variable is called fileList, not filelist.

          Free HISE Bootcamp Full Course for beginners.
          YouTube Channel - Public HISE tutorials
          My Patreon - HISE tutorials

          Dan KorneffD 1 Reply Last reply Reply Quote 0
          • Dan KorneffD
            Dan Korneff @d.healey
            last edited by Dan Korneff

            @d-healey said in Get list of midi files:

            fileList

            giphy.gif

            I've been sitting at the computer for 13 hours... maybe I need a break.

            Now that I'm using variables that actually exist in my project, it returns empty:

            Interface: 
            

            Also, thanks for the help. 👍

            Dan Korneff - Producer / Mixer / Audio Nerd

            1 Reply Last reply Reply Quote 0
            • d.healeyD
              d.healey
              last edited by

              What do you get with Console.print(fileList.length);?

              Free HISE Bootcamp Full Course for beginners.
              YouTube Channel - Public HISE tutorials
              My Patreon - HISE tutorials

              Dan KorneffD 1 Reply Last reply Reply Quote 0
              • Dan KorneffD
                Dan Korneff @d.healey
                last edited by Dan Korneff

                @d-healey 15, which is the amount of files in my test folder

                Dan Korneff - Producer / Mixer / Audio Nerd

                1 Reply Last reply Reply Quote 0
                • d.healeyD
                  d.healey
                  last edited by d.healey

                  Try this in place of your loop

                  for (f in fileList)
                  {
                  	Console.print(f.toString(File.FullPath));
                  }
                  

                  I also notice you're using some vars, always use local in inline functions, and in on init use reg or const. 99% of the time var should not be used except in paint routines, mouse callbacks, timer callbacks, and occasionally a few other places.

                  Free HISE Bootcamp Full Course for beginners.
                  YouTube Channel - Public HISE tutorials
                  My Patreon - HISE tutorials

                  Dan KorneffD 2 Replies Last reply Reply Quote 1
                  • Dan KorneffD
                    Dan Korneff @d.healey
                    last edited by

                    @d-healey said in Get list of midi files:

                    Try this in place of your loop

                    Now we're talking! that returns the file path correctly

                    Dan Korneff - Producer / Mixer / Audio Nerd

                    d.healeyD 1 Reply Last reply Reply Quote 0
                    • d.healeyD
                      d.healey @Dan Korneff
                      last edited by

                      @dustbro Yeah it's late here :) the objects in your array are all file objects so you have access to all of the File class functions, like toString()

                      Free HISE Bootcamp Full Course for beginners.
                      YouTube Channel - Public HISE tutorials
                      My Patreon - HISE tutorials

                      1 Reply Last reply Reply Quote 0
                      • Dan KorneffD
                        Dan Korneff @d.healey
                        last edited by

                        @d-healey said in Get list of midi files:

                        99% of the time var should not be used

                        Thanks for this advice as well.

                        Dan Korneff - Producer / Mixer / Audio Nerd

                        1 Reply Last reply Reply Quote 1
                        • First post
                          Last post

                        23

                        Online

                        2.0k

                        Users

                        12.7k

                        Topics

                        110.5k

                        Posts