Help with scripting
-
@d-healey it only shows me the numbers from 0 to 2 depending on what it selects out of three options
-
@Gudru Do you have the list items in an array? If so you can use the value as an array index.
Console.print(myArray[value]);
-
-
@d-healey yes! I saw another post using get(“items”) to get list of items in viewport, I tried printing out and it gives me a list of all entries
-
@d-healey but do you know how I can use the get items to print the selected entry, not all?
-
@Gudru Yeah I just showed you that in my last post :p
You get the items in an array and then you use the value as the index.
-
@d-healey it does not work, I get api call with undefined parameter 0
-
@Gudru Show me your code
-
HiseSnippet 832.3ocsUslaSDCD1NIKpY4gnHN.q5uRkBUIPoTIDhPyCTDz1HRoBIDpxcWmDqrq8JausDg5cgKD2.NDbCfwd2jrglVphn9eyiuY973YF2SJ7oJkPhvkOZRLEgumS+Ib8nliHLNpaKD9AN6STZpzKU0dShIJEM.gwEeqQAtbIj87qWuGIjv8oyUgPGKX9z2yhX54Z603crvvNj.5Qrnbducit9BdSQnHA3SQmZnXh+XxP5ADiaEbP36zNfoEx9ZhlpP3R6IBlzej3bdp+GyTrSCoFg5n9PfRU2QDFXXrQKp4HVXPuo2aEBhRu4UghoUgG6rOKfMS+7pwCsF7liHe8.WXQ5UbA5UOO8pkidKgR3bTpTJkV2ouujEqmawvm65zkCONCHPYOOUR8EU3GXmlBvCtdqHxXZGIHLCQkcedspd6Tq1luz0EJ8Js2YDo2wL54wBott2q7lBdHU2TDEK3fPkMl4wFFjt4ASjRxD.3LWLPqrASSiTVuY7PFm5MHg6qYBtmfOyUSxjhvJ9SyTUHjgIzMc+laYvnRDR2JVx.JXSymsV+BD0Kf.+Oo5VJiEaJZRBCOEZtpb4rCQKG2NPnoGxqXYf6Etd+soACVpsrXERkK0rouWdc.qvShNkJye+MNBMCK1g4b0cX4G.7SKM4bTv6xY5Cio7qZr.kUOMciYrBbUa6EeTVuHMXZ0CwBLMiyJlHKwysInA5icaQzjogChLjsXpTyLWDbK5YvlhzV8xNsnpwZQr02rmRDdsabx+5rD2f1XxbVDzHQAaiTPvvErsjlvAURcUWgrp6D1XppJ5bVfdDTbweGvLhxFNRaj9oc40kFLgUBhfjPhdw8DlkiYFfm1EFNMCfbESOI+xy+aKOtoTbcmdLs+nkywBKgivS2sAGyV4dem1CFP80yIXImNe51Y+J5ChDMiObehVxflEmCRh5C+53Sgry4zPynEtfYHHUtlQ1TA5S4AVgeCmLi0Mx3Li0mZDEQ7khS7SGcLK0WypA3D29eVY3iUP1a1rhiSsspghf+WNw22b8eBLWtbLOcEv7rU.y1q.lmuBX1YEv7hU.ytWKFyW6uIQKhRGG.E8Za2Ygws4Dnyx1Eh9CFSihRC
-
Don't call your array, array, because that's a type.
The
get("items");
returns a string. You need to convert it to an array usingsplit()
.const var Viewport1 = Content.getComponent("Viewport1"); const var items = Viewport1.get("items").split(","); inline function onViewport1Control(component, value) { Console.print(items[value]); }; Content.getComponent("Viewport1").setControlCallback(onViewport1Control);
-
@d-healey wow! Thank you very much david!
-
@Gudru whats wrong with
const var Viewport1 = Content.getComponent("Viewport1"); inline function onViewport1Control(component, value) { Console.print(component.getItemText()); };
-
@Lindon I didn't see that function in the API browser for viewports. Does it work?
-
@d-healey said in Help with scripting:
@Lindon I didn't see that function in the API browser for viewports. Does it work?
0h viewport, sorry I was thinking of ComboBox....
https://docs.hise.audio/scripting/scripting-api/scriptcombobox/index.html#getitemtext