Read the menu from a JSON file and write that to a menu button

Hi there
I want to read the menu of a widget from a JSON file.
Here in my example I read the JSON file with the "variable_harpScale" and I want to write with the second "variable_setScale" to my Menu_B widget.
What can I change so that both (Menu_A but also in Menu_B) has an entry from the beginning.

Or am I just thinking too complicated?

Bildschirmfoto 2023-04-10 um 09.49.50
Here is my START.json Session:
MenuFromJSONfile.zip (3.5 KB)

Move variable_setScale's onValue script to variable_harpScale's onValue so that it gets executed when the harpScale.json is loadded, and call set() at the end of that script to define the initial value.

Thanks for that... I hope I did all right.

Here ist the new version:
MenuFromJSONfile_v2.zip (3.8 KB)

I only have one error message in the console. What me confused in the console is that the error line is after the "console.log(ScaleButtonName)" result, even the problem is already on line 3.
Do you know, what this is?

I reloaded the session on my touchscreen. Maybe it was a cache problem on my site. Semms to work great. Thanks

Thanks for sharing ! Would you tell me what is the meaning of the value displayed in the second row second column?

You might want to replace get('variable_harpScale') with value since get() is not needed anymore.

Hi Greenman
that is only for controlling my results.
The first row is 0 -11 are for the keys (C, C#|Db, D, ...)
the second row are the scales (0 = major, 1 = minor, ...) i have in my json file.

Here is my plan in the excel file

yep but the values in green 2, 2, 2, 2... for the c scale major i.e. ? this is not the tone numbers between two notes... so ? :slight_smile:

This information I need for the pedals from my harp. Take the D as example
Db = 1, D = 2, D# = 3
Bildschirmfoto 2023-04-10 um 15.16.53

All numbered with 2 are all the white keys. (In the picture you have Bb as 1)

2 Likes

Good to know... Thanks