Is there a way to make a button that adds/removes a task on another button?
eg:
Button 1 adds a specific task to button 2.
Button 3 removes that same task from button 2.
cheers
james
Is there a way to make a button that adds/removes a task on another button?
eg:
Button 1 adds a specific task to button 2.
Button 3 removes that same task from button 2.
cheers
james
There is no ogscript command to add/remove tasks specifically.
There are 2 ways I can see to do something like this:
I would just use a parameter to store whether the Button2 task should run or not. Button1 sets that parameter to 1, button 3 sets that parameter to 0. Button2 checks if the parameter is 1 before running anything.
There is a “setXML” method that allows us to change the oglml of a particular element. You would need to specify the entire button definition, but it should work. Here is an example:
ogscript.setXML(‘button2_abs’, xml);
var xml = ‘’;
xml = xml + ‘’;
xml = xml + ’ ogscript.debug(“I am button2, set by button3”)';
xml = xml + ‘’;
xml = xml + ‘’;
ogscript.setXML(‘button2_abs’, xml);
Click on Button1 to make Button2 appear, then click on Button3 to change what it does. You’ll need to have the openGear Debug Information window open to see what the buttons do since they only do debug messages.
thanks Ben. Playing around with this now.
You could also put your script in a string array and use the JavaScript eval function:
ogscript.debug("TEST 1"); var buttonScripts = params.getAllValues('button_scripts'); for (var i = 0; i < buttonScripts.length; i++) { eval(buttonScripts[i]); } var debugString = 'TEST ' + (params.getElementCount('button_scripts') + 1); params.setValue('button_scripts', params.getElementCount('button_scripts'), 'ogscript.debug("' + debugString + '");'); if (params.getElementCount('button_scripts') > 0) { params.getParam('button_scripts', 0).remove(); } [#DashBoard](https://livinglive.community/search?s=tags%3A%22DashBoard%22&executesearch=true)