0
Beantwoord
Trigger a script from a button press
I am working on a small project where by depending on the value of a server tag/feedback, when a button is pressed it will show a particular popup.
IR.AddListener(IR.EVENT_TAG_CHANGE , IR.GetDevice("F10A-SERVER-01"), function(name,value) { IR.Log("Name = " + name + ", Value = " + value); //For Debug Only if(name == "LAB1-SIM" && value == 1) { IR.ShowPopup("LabLink_Receive_Lab1"); } else if(name == "LAB1-SIM" && value == 0) { IR.ShowPopup("LabLink_NoAccess"); } }); };
In this example, there is a tag on my server called 'LAB1-SIM.' When a particular button is pressed (lets call it 'load' for now) it should load either the 'LabLink_Receive_Lab1' or 'LabLink_NoAccess' popup depending on the value of the tag (0 or 1).
The trouble I have is tying this script to a button press. The script should only be executed when the button is pressed, not at project startup or if the tag value changes. Any help would be greatly appreciated!
Customer support service by UserEcho
Hello.
ex.irpz
Thank you for this! I changed the code to request the status from the Server Feedback and will test tomorrow when I get to our labs. This is to allow our users to 'enable' or 'disable' the ability for other control panels in other labs to access video controls. If enabled, a user in another lab can then see a popup allowing them to route video content to a local projector. If disabled, they will see a popup advising they need to ask permission from the other lab.
Hello.
Do you have any more questions?
Thank you for your help. The code works really well - it's a great snippet to build other ideas now:
Happy to help.