You can make a button run a trigger script by setting it up as explained below.
- Create a tagg named: RUNSCRIPT_CMD and link it to a DrvDisk IO-device
- Edit you button on a page and go to section "Write and read tags" and in field "Write to tags" type in RUNSCRIPT_CMD=1
- Navigate to "System settings" -> "Scripts" -> "Trigger Scripts". Create a Trigger script and use the RUNSCRIPT_CMD=1 tag as the trigger in the settings for your script.
-
End your script by writing 0 to the RUNSCRIPT_CMD tag with the following script line below
tags["RUNSCRIPT_CMD"].WriteValue(0, true); - Done!
NOTE!
This feature is not compatible with Call scripts; it exclusively functions with Trigger scripts only.
Tip
You can also call a call script using a button by using the button’s “Run javascript” setting.
In that field, write: fetch("/script/run?type=callscript&id=scriptname");
Can a script be run with a button?
How can I trigger a script using a button?
Is it possible to execute a script by clicking on a button?
What steps are involved in making a button activate a Trigger script?
How do you set up a Trigger script to run using a button?