I need to work with JavaScript to create scripts for some musical program.
After some days of researches I've made some good progress.
Right now I'm having problems to pass a string to a function as parameter, though.
Code: Select all
const kPackageID = "My first test script"; // package ID (must be unique)
function testAction(actionValue)
{
this.interfaces = [Host.Interfaces.IEditTask, Host.Interfaces.IParamObserver] //, Host.Interfaces.IObserver]
this.prepareEdit = function (context)
{
return Host.Results.kResultOk;
}
this.performEdit = function (context)
{
switch (actionValue)
{
case "testA":
testA();
break;
case "testB":
testB("Test");
break;
}
}
}
function testA()
{
var stringVar = "A simple test"
Host.GUI.alert("My message is: "+stringVar); // Result = My message is: A simple test
return
}
function testB(value)
{
Host.GUI.alert("My other message is: "+value); // Result = My other message is: [object Native_00000000003F0000_ScriptUplink]
return
}
I already tried to call it with testB('Test');, but the result is the same strange one.
Thanks for any help and best regards!