Help with variables in javascript

I have some string variables in a .js file that I would like to save as BTT persistent string variables.

The code of this .js file is a Cubase MIDI Remote API Script, written in the ES5 version of JavaScript.

This .js file is always executed from this DAW (Cubase).

If I write the following code in this .js file, it gives me an error:

(async ()=> {

let result = await set_persistent_string_variable({variable_name: 'test', to: "this is a test value"});

returnToBTT(result);

})();

Executing the same code in Apple Script editor (selecting Javascript) doesn't give any error.
The result is "[object Promise]" and no BTT variable called "test" is created.

As I am very bad with javascript, I don't know if I am doing something wrong, or there is a bug in this code.

All I want to do is to save some js string variables as BTT persistent variables.

If that's not possible, I would like to save these js string variables in an external file (txt or plist) for working with them.

Thanks in advance!

I'm not whether I understand, is this JS running in BTT's context or in cubase? (only if is run inside BTT's script actions you can use the BTT scripting functions)

It is running in Cubase context.

Is there a "global" way to save the string variables in an external text file or plist file? Or should I ask that in the cubase forum?

Sorry for my stupid questions, I am very hopeless with js :grimacing:

unfortunately this really depends on the implementation, I think you need to check the cubase docs/forum for this

Can you execute shell scripts or apple script from cubase JS?

Good idea, I will check that…