Complete Button in JS
Paulo de Almeida 5 jaar geleden • bijgewerkt door anonymous 4 jaar geleden • 7
I want to allocate all variables via JS script to a button. OnPress Event, a Delay, a Feedback Relation. Everything I have now set up via the non script way I want to remove and have the button completely controlled via JS...
I can’t seem to find in the documents the commands to allocate feedback via JS to a button
Customer support service by UserEcho
To process the press, use IR.EVENT_ITEM_PRESS.
To delay command execution, use IR.SetTimeout.
To get feedback, use this IR.EVENT_TAG_CHANGE.
Look at the attached example. If we understand you correctly, we will add to our website documentation on your questions.
Thank you for your reply. One thing i have not understood is how to the set the relations of a button in JS
Clarify: do you want to JS by pressing the button to send a certain value to the driver? If so, you can use Set:
No i want to have the Buttons status (Relation) set by the script.
Right now i need to set the relation of the button by selecting the dropdown list and then choose a feedback channel to connect with this button....
I would like to do this via the script.
Why? because if you have 200 Buttons it will be easier to change the channel via script other than to click on each button in the GUI and then dropdown list and then scroll to find the feedback then select feedback...
Yes, you can:
IR.GetPage ("Page 1").GetItem ("Item 1").State = 1;
Through JS it is impossible to keep in touch feedbacks with buttons. The iRidium editor is designed for this purpose. You can write a value to the feedback via SetFeedback or send a command to the driver via Set. You can subscribe to the desired feedbacks via GlobalListener, but we strongly do not recommend this. Because it will complicate debugging if something doesn't work properly.
I've also been wanting this for some time. Using the GlobalListener means I have to keep track of all the created buttons and the feedbacks they are linked to, to be able to update the state of the correct button.
It would be a lot easier if we could do (for example):
IR.GetItem("Page 1").GetItem("Button 1").AddRelation(IR.GetDevice("Device 1").GetFeedback("Feedback 1");