HISE Logo Forum
    • Categories
    • Register
    • Login

    Save Preset in Path

    Scheduled Pinned Locked Moved Scripting
    8 Posts 3 Posters 477 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.
    • CasmatC
      Casmat
      last edited by

      Hey!

      Quick question, using the Engine.saveUserPreset() function, how do I make it so the preset is saved in a particular folder in user presets. Specifically, I have this path: User Presets\Custom\User and would like all user presets to be saved in that folder. Thanks!

      i make music

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

        Link Preview Image
        How to Save a Preset?

        File/FileSystem API inline function savePresetAs() { FileSystem.browse(FileSystem.getFolder(FileSystem.UserPresets), true, "*.preset", function(f) { ...

        favicon

        Forum (forum.hise.audio)

        Libre Wave - Freedom respecting instruments and effects
        My Patreon - HISE tutorials
        YouTube Channel - Public HISE tutorials

        CasmatC 1 Reply Last reply Reply Quote 0
        • CasmatC
          Casmat @d.healey
          last edited by

          @d-healey Thanks David! Got another question however, when using the function, it opens up a save as prompt with the os file browser, it then makes a "fake" path for that preset file to go and then uses the Engine.saveUserPreset() function to actually create the file. The thing is, I have a variable which stores the location of the

          User Presets\Custom\User

          User folder. Instead of making the os browser prompt for the save as path, I have a popup panel with a label that I can get text value for (same concept as my rename one). How do I make it so that I concatenate the user folder variable with the text value plus the preset part? It should look something like this: folderUser + lblTextEntry + ".preset". The problem is how do I make sure the concatenation works for all os's since the way the directories in multiple os's are separated can differ.

          Thanks!

          i make music

          d.healeyD JayJ 2 Replies Last reply Reply Quote 0
          • d.healeyD
            d.healey @Casmat
            last edited by

            @Casmat If you use forwarded slashes it should work

            Libre Wave - Freedom respecting instruments and effects
            My Patreon - HISE tutorials
            YouTube Channel - Public HISE tutorials

            CasmatC 1 Reply Last reply Reply Quote 0
            • CasmatC
              Casmat @d.healey
              last edited by Casmat

              @d-healey folderUser + "/" + lblTextEntry + ".preset" So that should work across all os's?
              edit: whilst converting the folder to string!

              i make music

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

                @Casmat Yup. Test it, if it doesn't work then you can use Engine.getOS() and do it differently for each one.

                Libre Wave - Freedom respecting instruments and effects
                My Patreon - HISE tutorials
                YouTube Channel - Public HISE tutorials

                1 Reply Last reply Reply Quote 1
                • JayJ
                  Jay @Casmat
                  last edited by

                  @Casmat Did you manage to do it? if so how

                  Joansi Villalona

                  CasmatC 1 Reply Last reply Reply Quote 0
                  • CasmatC
                    Casmat @Jay
                    last edited by Casmat

                    @Jay Using this:

                    Engine.saveUserPreset(folderUser.toString(File.FullPath) + "/" + saveTextField);
                    
                    

                    folderUser is one of my subfolders in the UserPresets folder, then the to string converts that path to the full path and the saveTextField is the string the user entered as the name they want to save. Hope this helps!

                    i make music

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

                    20

                    Online

                    1.7k

                    Users

                    11.8k

                    Topics

                    102.6k

                    Posts