Custom Export/Import of UserPresets
-
is there a way to create a custom preset export/import system...the goal would be to export specific folder or folders from the user presets folder and then import those presets into another system...use case say I create a preset or set of presets on my plugin on my MacBook but I want to import those specific presets into the same plugin on my Mac Studio...using the "Export Presets As A Collection" option exports/imports everything not ideal having to write/overwrite presets in the folder each time in case I have tweaked the built in presets already...and plus I don't want end users having to poke around in the app data folders...just a simple click of a Export/Import preset button...possible?
-
-
@johnmike you could create your own using the file and file system APIs
-
@d-healey thanks...dug around and was able to find a couple of other examples that I kinda reverse engineered to basically just copy a user selected folder from the file system to userpresets folder...
HiseSnippet 1296.3ocsW80aaaCDmxIpawaqXcXOtGXySx.YN1ascCXnXo1NdvXKodyoECnXnfQh1lHzjBjTIQnM.8qz9lsuAaGknkkkcSbLvzShGu628Wd73PkLjp0RExauyRioHuO2eTpvLs6TBSfFzC48P+SHZCUgyI0IMln0zHjm2N+hkf2d6hx99metCgSDgzEjPnWKYgzeiMiYVPc3Q+Jiy6ShnmwlUh6mbzfPonqjKS.6YG+VnXR3EjIzSIV1p4i7dvwQLiTMxPLTMvSGYT5noxqD47+ZllcNmZWzFMB.JmLp6TFOZ3beUiPd6NbgmuStm+09mvhXEzWDA9xrMvKjnbLvq1sYRsuGljWISZ2bS5Q9iBUrXyhcr1ym4OP.IjwDHTW1Tx4EU6u+D+tRfCgo4LxEz9JXQgDAOqUqCvOsUqF+T85GdH9UCvcRLFoPWGB9ZC9RhBas+gJplZ5K4QPt+434HNgZ5JmEKEvhf8qx39.pKfY.vmxjuutiQ7QgoJi.L3bqSSUNx3XhYZIvSVrUgQ1mwoiRgp0YVEjSNnDwRv4b+ynVUSToVLYDHSgMRrFRnT74YwErhNlpnPcccEcBlDZXWRyM3BOHGKav.mCO1YRNH3xIrv5LAmIn3wIB.CfpTTM7EDNGwC.6gmPaT+c0wvGaLNvQ.69Vw+apAzB.+5l50qBbSsMdKLJIuKgyOGNWErp5cwjbmCOOtW1GvqwIpl71Tm3cEtxZioP5LrT7cNukxlmqjWoo8kpdLEMDRYoA2UAPOp9BiLtwAENP.KSst.PgZVXbys7Gyz8niAeOZYQvu+83GWlRSfwBCpQik.ZYXseGKl.Xlk6NANhCc65HuFNQHfHEKBOhxoY149Gf2eHmRzTrNiFlfyYYbtVAFZCIvp3u1Xqsb301LQvXBWS2XwBmRDSf.vZDPQMIJwxzuwl1fBpWvglOBhEQ7LpYpLBWeYYm37hgvYbHwuT3zHGYTLwj.nkkEsV1C5IbdFuLQFzbd5JHZ6WLjnfJ3mWB8l5XNCZ4bXVOl0aE16a.gJ.3ME+0jSES.09s31+Uohx4haHpIk5Yt5QTaaOaieaIYvBk0vgE3cckwoXHVCUPNqAGkUMUwCWJDEBBETV4MpXberpr7S5iRBsWuLNgmUkk2Ayobcwd7TmRoQ1hsVU0wVToswUY239+FayspMbVeyspbAHTpo0oRC8kh.aqo8.LwU2Z730tmSMbnqx511NOi51DLPjL6bppTiwLFgK7WdJhGrYSQDleaZIFA+VvLuLl5VmUNDk++pybfbWGCSeTyYg.qlrYOdna1i7oCPL.juxuZPEk4GkmADsQ3T8lmp3.euZPOhgXmKxYjfgGSUFlM930idILXY9TR646Zqm4EtpHHFde7iqKz8G98iRKVbT7QWwhLSQd9de.VOkxlL0XW8MnrvWg11893sWWVAKoMzpCABieJiR3DyxyjZG91sAThszff1g8DZlIsbh4dLnZqacP0M0Dej+PlIb55swZqwFsUg+OXitw6+B+iGOF5itv.20u+etsyxeGp+OjIF3JqSHvMWPx1+zjYifW0DRAsKDTt1VBUyVAkutkcsMBLhJhxV7uvmay110dtMaOeSzLRnR91v7ia1GP7oYT.aRj8do8fGtAqwsW8v0L38LuMLbYnVQvuaaE762VAex1J3S2VAe11J3OrsB9i2sf1ma9hDibV9wFD5jgGm0Lzy6Xg8MJYUqn+C.ylTZC
-
@johnmike Nice!
A few suggestions
Use
var
inside your function rather thanreg
- Uselocal
if it's an inline function.
This variable isn't needed
activeImportComponent
You can just use the button reference you already have
Avoid magic numbers:
Replace
importFolder.toString(0); // 0 = FullPath internally
With
importFolder.toString(importFolder.FullPath); // No need for a comment, it's self-documenting :)
Or instead of getting the full path you could just get the folder name, which is all you need.
You can find a list of the available options here - https://docs.hise.audio/scripting/scripting-api/file/index.html#tostring
-
@d-healey ahhhh really cool! Makes sense and definitely cleaner!
-