The input PVs for a script can be accessed in script via pvArray object.
The order of the input PVs in the configuation list is preserved in pvArray.
pvArray[0] is the first input pv. If you have N input PVs, pvArray[N-1]
is the last input PV.
In script, you can read/write the input PVs and get the timestamp or severitis of the PVs via the utility APIs provided in PVUtil
importPackage(Packages.org.csstudio.opibuilder.scriptUtil); var value = PVUtil.getDouble(pvArray[0]); widgetController.getWidgetModel().setPropertyValue("start_angle", value);
Only the input PVs are allowed to write in the script. If writing a PV is forbidden by PV security, an exception will be returned and shown in console. The method PV.setValue(data) accepts Double, Double[], Integer, String, maybe more.
importPackage(Packages.org.csstudio.platform.data); pvArray[0].setValue(0);
importPackage(Packages.org.csstudio.opibuilder.scriptUtil); var RED = ColorUtil.RED; var ORANGE = ColorUtil.getColorFromRGB(255,255,0); var GREEN = ColorUtil.getColorFromHSB(120.0,1.0,1.0); var PINK = ColorUtil.PINK; var severity = PVUtil.getSeverity(pvArray[0]); var color; switch(severity){ case 0: //OK color = GREEN; break; case 1: //MAJOR color = RED; break; case 2: //MINOR color = ORANGE; break; case -1: //INVALID default: color = PINK; } widgetController.getWidgetModel().setPropertyValue("foreground_color",color);