Olá a Scadistas! :)
Atualizando os exemplos de Scripts para o Servidor. Quem já tentou acessar o link do mango reparou que a estrutura do forum deles mudou e o link não leva mais até onde queríamos. Aproveitando que o Diego Ferreira fez backup da internet kkk, vou postar abaixo:
Exemplos de Script para Servidor:
###Botão de parada única
var s = "";
if (value)
s += "<img style='cursor:pointer;' src='graphics/Botao-3D/botao20.png' onclick='mango.view.setPoint("+ point.id +", ""+ pointComponent.id +"", "false");return false;'/>";
else
s += "<img src='graphics/Botao-3D/botao10.png'/>";
return s;
###Botão de Liga e Desliga
var s = "";
if (value)
s += "<img style='cursor:pointer;' src='graphics/Botao-3D/botao20.png' onclick='mango.view.setPoint("+ point.id +", ""+ pointComponent.id +"", "false");return false;'/>";
else
s += "<img src='graphics/Botao-3D/botao10.png' onclick='mango.view.setPoint("+ point.id +", ""+ pointComponent.id +"", "true");return false;'/>";
return s;
###Botão de Pulso
var s = "";
if (value) {
s += "<img style='cursor:pointer;' src='graphics/Botao-3D/botao20.png' ";
s += "onclick='mango.view.setPoint("+ point.id +", ""+ pointComponent.id +"", "false"); ";
s += "setTimeout(mango.view.setPoint("+ point.id +", ""+ pointComponent.id +"", "true"),2000);return false;'/>";
} else
s += "<img src='graphics/Botao-3D/botao10.png'/>";
return s;
###Botão de Liga e Desliga com confirmação
var s = "";
if (value)
s += "<img style='cursor:pointer;' src='graphics/Botao-3D/botao20.png' onclick='if(window.confirm("Deseja continuar?")){ mango.view.setPoint("+ point.id +", ""+ pointComponent.id +"", "false")}else{ window.alert("Cancelado!");};return false;'/>";
else
s += "<img src='graphics/Botao-3D/botao10.png' onclick='if(window.confirm("Deseja continuar?")){ mango.view.setPoint("+ point.id +", ""+ pointComponent.id +"", "true")}else{ window.alert("Cancelado!");};return false;'/>";
return s;
###Select/Combobox
var s="";
s+="<select onChange='mango.view.setPoint("+ point.id +", ""+ pointComponent.id +"", this.options[this.selectedIndex].value )'>";
s+= "<option value=1";
if (value == 1 ) { s+= " selected ";}
s+= "> one </option>";
s+= "<option value=2";
if (value == 2 ) { s+= " selected ";}
s+= "> two </option>";
s+= "<option value=3";
if (value == 3 ) { s+= " selected ";}
s+= "> three </option>";
s+= "<option value=4";
if (value == 4 ) { s+= " selected ";}
s+= "> four </option>";
s+="</select>";
return s;
###Select multiestados
//Multi State Select example
//list of states (value key and the text)
var MSList=point.getTextRenderer().getMultistateValues();
var min = 0;
var max = MSList.size();
var s="";
var s2=""; //temporary inside loop, to be able to set the color
//check if list has values
if(max==0){return "No States defined";}
//sanity limit
if(max>100){return "More than 100 states";}
s+="<select ";
for(var i = min; i < max ;i++)
{
s2+= "<option ";
//use the state colours
s2+= "style='color:"+ MSList.get(i).getColour() + "' ";
s2+="value="+ MSList.get(i).getKey() ;
if (value == MSList.get(i).getKey())
{
s2+= " selected ";
//set the select color according to the value
s+= "style='color:"+ MSList.get(i).getColour() + "' ";
}
s2+= "> "+MSList.get(i).getText()+"</option>";
}
s+="onChange='mango.view.setPoint("+ point.id +", ""+ pointComponent.id +"", this.options[this.selectedIndex].value )'>";
// put the options into the string
s+=s2;
s+="</select>";
return s;
###Campo de texto
var s = "<input type="text" onChange='mango.view.setPoint("+ point.id +", ""+ pointComponent.id +"", this.value);return false;' value=" + value + "/>";
return s;
###Checkbox
var s = "";
if (value){
s += "<input type="checkbox" onclick='mango.view.setPoint(" + point.id +", ""+ pointComponent.id +"", "false");' checked/>";
} else {
s += "<input type="checkbox" onclick='mango.view.setPoint(" + point.id +", ""+ pointComponent.id +"", "true");'/>";
}
return s;
###Valor com mudança da cor de fundo
var s = "<a ";
if(value > 20)
s += "style="background-color:#00ff00;font-size:250%;"";
else
s += "style="background-color:#ff0000;font-size:250%;"";
s += ">" + value + "</a>";
return s;