Get Preset Category Name to print?
-
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! -
C Chazrox marked this topic as a question
-
@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)
-
@ustk makes sense! Can do.
Thanks.
-
@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
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("/")));
-
@ulrik Sweet! Man im still not that good with string manipulation. Thank you!
-
@ulrik why not just split the path name with
pathString.split("/")
then take the elementresult[result.length - 2]
-
@ustk I need to learn this asap.
-
@ustk yes that's good
-
const var pl = Engine.getUserPresetList(); const var p0 = pl[0].split("/"); const var cat = p0[p0.length-2]; Console.print(cat);
-
C Chazrox has marked this topic as solved
-