HISE Logo Forum
    • Categories
    • Register
    • Login

    Get Preset Category Name to print?

    Scheduled Pinned Locked Moved Solved Scripting
    10 Posts 3 Posters 120 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.
    • ChazroxC
      Chazrox
      last edited by Chazrox

      How can I get the preset name & The preset category that it belongs to in the stock preset browser?
      I know how to get the preset name. How do I get the category/bank that it belongs to?

      Hope whoever reads this is having a great day! 🙏
      Thanks in advance!

      ustkU ulrikU 2 Replies Last reply Reply Quote 0
      • ChazroxC Chazrox marked this topic as a question
      • ustkU
        ustk @Chazrox
        last edited by

        @Chazrox I'm not in ftont of my computer but you can get the preset name as file path. From here you can parse the string to get the directories (which are the category names)

        Hise made me an F5 dude, browser just suffers...

        ChazroxC 1 Reply Last reply Reply Quote 1
        • ChazroxC
          Chazrox @ustk
          last edited by

          @ustk makes sense! Can do. 🙏 Thanks.

          1 Reply Last reply Reply Quote 0
          • ulrikU
            ulrik @Chazrox
            last edited by

            @Chazrox you'll get the path for each preset by using the

            Engine.getUserPresetList()
            

            then you have some string functions to extract what you need

            Skärmavbild 2025-08-26 kl. 11.30.17.png Skärmavbild 2025-08-26 kl. 11.30.03.png Skärmavbild 2025-08-26 kl. 11.29.55.png

            ex

            the path to preset at index 0 is "Bank/Half-Half"

            using some of the functions you can get the bank name

            reg presetsList = Engine.getUserPresetList();
            Console.print(presetsList[0]);
            Console.print(presetsList[0].substring(0, presetsList[0].lastIndexOf("/")));
            

            Skärmavbild 2025-08-26 kl. 11.35.03.png

            Hise Develop branch
            MacOs 15.3.1, Xcode 16.2
            http://musikboden.se

            ChazroxC ustkU 2 Replies Last reply Reply Quote 1
            • ChazroxC
              Chazrox @ulrik
              last edited by Chazrox

              @ulrik Sweet! Man im still not that good with string manipulation. Thank you! 🙏

              1 Reply Last reply Reply Quote 0
              • ustkU
                ustk @ulrik
                last edited by

                @ulrik why not just split the path name with pathString.split("/") then take the element result[result.length - 2]

                Hise made me an F5 dude, browser just suffers...

                ChazroxC ulrikU 2 Replies Last reply Reply Quote 2
                • ChazroxC
                  Chazrox @ustk
                  last edited by

                  @ustk I need to learn this asap.

                  ustkU 1 Reply Last reply Reply Quote 0
                  • ulrikU
                    ulrik @ustk
                    last edited by

                    @ustk yes that's good

                    Hise Develop branch
                    MacOs 15.3.1, Xcode 16.2
                    http://musikboden.se

                    1 Reply Last reply Reply Quote 1
                    • ustkU
                      ustk @Chazrox
                      last edited by ustk

                      @Chazrox

                      const var pl = Engine.getUserPresetList();
                      
                      const var p0 = pl[0].split("/");
                      
                      const var cat = p0[p0.length-2];
                      
                      Console.print(cat);
                      

                      Hise made me an F5 dude, browser just suffers...

                      ChazroxC 1 Reply Last reply Reply Quote 1
                      • ChazroxC Chazrox has marked this topic as solved
                      • ChazroxC
                        Chazrox @ustk
                        last edited by

                        @ustk Thanks guys. @ulrik

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

                        23

                        Online

                        1.9k

                        Users

                        12.4k

                        Topics

                        107.9k

                        Posts