Creating Menus and their Values

Oh man - okay so I'm in some real need of help. For the sake of this post, let's assume I know nothing at all about scripting/javascript, but I can follow directions.

I'm using the menu widget to create a sort of 'circular toolbar', and I've hit a snag where I'm not sure how to proceed.

For Menu> Values, it's currently showing

Screen Shot 2021-11-05 at 1.13.14 AM

I don't want those numbers to be what my menu consists of, but anything else entered there messes up the format of the circular menu. I assume this is by design, and I have to assign an ID or name to each of those values (eventually I'll put an icon instead, but I'll keep this basic for now)

I couldn't find any information or examples on the OSC documentation explaining how to assign names to these values (in simple terms for me, how to turn those numbers into words, that act as their own individual buttons), and then further, wouldn't each of those menu options need to be their own button widget in order to assign the OSC preArgs/target?

Please please please forgive my ignorance here - scripting is obviously not my strength but happy to learn.

Thanks,
AJ

Hello,

I've also been there when I started with OSC and I totally admit that it was not so easy but here you go:

Make sure you insert %key into the label property so you can see the selected word from the menu appearing, not numbers.

Hope that helps !

Swayrian

1 Like

Oh wow thanks so much - that helped a lot!

From there, do those values need to be defined elsewhere to turn them into buttons (or in my case, commands to select a tool in my DAW)?

In your case if you want those values you have in your menu to be assigned to an address (CC, note etc...) in order to command a tool in your DAW, you have to use the script property of the menu as described in the documentation: Scripting - Open Stage Control

Also, it's interesting to mention that there are two methods to insert values into a menu.
1rst method:
It's the screenshot I sent above

2nd method (without numbers):

[
"Hello!",
"You",
"Will",
"Resolve",
"Your",
"Issue",
"Have a nice day!"
]

I personally prefer the 1rst method as I find easy to keep track of the values I have and it's also quicker to write numbers than words later on in the script property.

Swayrian

In your case if you want those values you have in your menu to be assigned to an address (CC, note etc...) in order to command a tool in your DAW, you have to use the script property of the menu as described in the documentation: Scripting - Open Stage Control

For example:

if (value == "Hello") {
  send("midi:my_daw", "/control", 1, 100, 127) 
} else if (value == "You") {
  send("midi:my_daw", "/control", 1, 101, 127) 
} // etc

Edit: this applies to swayrian's 2nd method above.

Okay first - thanks for your responses. I took another look at the documentation (when I wasnt super tired) and it makes sense there, as well as the example you've put, JE

Ive entered in everything in to the script portion of this widget, and verified in my daw that all args are correct, but for whatever reason these buttons are still not triggering. (BTW, i've changed this widget to a 'switch' instead of 'menu', but I think this portion works the same)

Values look like this:

Screen Shot 2021-11-08 at 3.21.11 PM

OSC panel like this:
Screen Shot 2021-11-08 at 3.21.58 PM

And where I thought this looks correct, I'm sure I've overlooked something here - or its just not formatted correctly; the script for the entire menu

if (value == "Object Select") {
    send(midi:OSC", "/control", 2, 5, 127)
} else if (value == "Range Select") {
    send("midi:OSC", "/control", 2, 6, 127)
} else if (value == "Draw") {
    send("midi:OSC", "/control", 2, 7, 127)
} else if (value == "Cut") {
    send("midi:OSC", "/control", 2, 8, 127)
} else if (value == "Glue") {
    send("midi:OSC", "/control", 2, 9, 127)
} else if (value == "Mute") {
    send("midi:OSC", "/control", 2, 10, 127)
} else if (value == "Zoom") {
    send("midi:OSC", "/control", 2, 11, 127)
} else if (value == "Comp") {
    send("midi:OSC", "/control", 2, 12, 127)
} else if (value == "TimeWarp") {
    send("midi:OSC", "/control", 2, 13, 127)
} else if (value == "Curve") {
    send("midi:OSC", "/control", 2, 14, 127)
} else if (value == "Play") {
    send("midi:OSC", "/control", 2, 15, 127)
} else if (value == "Color") {
    send("midi:OSC", "/control", 2, 16, 127)
}

I feel like I'm close, but missing something critical. Once again, apologies for lack of knowledge here, but I really appreciate all your help so far.

Thanks

AJ

Quick edit* I see the script error missing the ", but fixing that in O-S-C did not resolve the issue

I missed an important point, when values are set as you did, the keywords are only used as labels and the menu's actual value will be whatever is written after the colon. Writing value == 3 instead of value == "Draw" will work.

1 Like

No worries! I actually also discovered this when a friend of mine suggested I put this in the script:

if (true) console.log(value)

as well as open up a new browser where I could open and view console (the touchscreen interface is running on a tv box, so functionality there is limited) and when I hit the switch/menu buttons, it was returning numerical values instead of the words. So this told me to change it to the numbers and its mostly working now!

I have some tweaks to make like making sure the button stays "on" when selected, and getting the widget to display anything when not being interacted with - but I think I can figure those out.

Thanks for your help!

AJ