@@ -8,8 +8,17 @@ Access PV in Script
88The input PVs for a script can be accessed in script via ``pvs `` object. The order of the input PVs in the
99configuration list is preserved in ``pvs ``. ``pvs[0] `` is the first input pv. If you have N input PVs, ``pvs[N-1] `` is the last input PV.
1010
11- A button-type widget configured to execute script(s) should instead
12- reference pvs using ``widget.getPV() `` or ``widget.getPVByName(my_pv_name) ``.
11+ When using the ``pvs `` object, the display runtime will invoke the script once all PVs connected
12+ and then whenever those marked as a "Trigger" change.
13+ Scripts might also access PVs associated with a widget like this, but the preferred way
14+ is using ``pvs `` for PVs listed as script inputs.
15+
16+ .. code-block :: python
17+
18+ from org.csstudio.display.builder.runtime.script import ScriptUtil
19+ pv = ScriptUtil.getPrimaryPV(widget)
20+ pvs = ScriptUtil.getPVs(widget)
21+ pv = ScriptUtil.getPVByName(widget, " SomePVName" )
1322
1423 You can read/write PV or get its timestamp or severity via the utility APIs provided in ``PVUtil ``.
1524
@@ -20,16 +29,18 @@ You can read/write PV or get its timestamp or severity via the utility APIs prov
2029.. code-block :: python
2130
2231 from org.csstudio.display.builder.runtime.script import PVUtil
23- value = PVUtil.getDouble(pvs[0 ]);
32+ value = PVUtil.getDouble(pvs[0 ])
2433
2534 **Write PV Value **
2635
36+ While the ``pvs `` are configured as script inputs, they may also be used
37+ as outputs by writing to them.
2738Several method argument types are supported, e.g. Double, Double[], Integer, String. If writing a PV is forbidden by
2839PV security, an exception will be thrown and shown in console.
2940
3041.. code-block :: python
3142
32- pvs[0 ].write(0 );
43+ pvs[0 ].write(0 )
3344
3445 **Get severity of PV **
3546
0 commit comments