From 8dbe2ec64d6f50d0c0c1057c25b8af4702777f0a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Jean-Fran=C3=A7ois=20Denis?= <jfdenis@cea.fr>
Date: Thu, 8 Dec 2016 10:38:33 +0100
Subject: [PATCH] Add script to change PLC screens

---
 opi/EMU.opi           | 495 +++++++++++++++++++++++++++++++++++++++---
 opi/Scripts/PlcOpi.js |  19 ++
 2 files changed, 478 insertions(+), 36 deletions(-)
 create mode 100644 opi/Scripts/PlcOpi.js

diff --git a/opi/EMU.opi b/opi/EMU.opi
index 9af59a9..fc72db6 100644
--- a/opi/EMU.opi
+++ b/opi/EMU.opi
@@ -51,6 +51,7 @@
     <active_tab>0</active_tab>
     <tooltip></tooltip>
     <height>1165</height>
+    <tab_2_icon_path></tab_2_icon_path>
     <border_width>1</border_width>
     <border_color>
       <color red="0" green="128" blue="255" />
@@ -67,9 +68,13 @@
       <color red="255" green="255" blue="255" />
     </tab_1_background_color>
     <tab_1_icon_path></tab_1_icon_path>
+    <tab_2_foreground_color>
+      <color red="0" green="0" blue="0" />
+    </tab_2_foreground_color>
     <tab_1_font>
       <opifont.name fontName="Cantarell" height="11" style="0">Default</opifont.name>
     </tab_1_font>
+    <tab_2_enabled>true</tab_2_enabled>
     <background_color>
       <color red="240" green="240" blue="240" />
     </background_color>
@@ -86,18 +91,25 @@
       <color red="255" green="255" blue="255" />
     </tab_0_background_color>
     <widget_type>Tabbed Container</widget_type>
+    <tab_2_font>
+      <opifont.name fontName="Cantarell" height="11" style="0">Default</opifont.name>
+    </tab_2_font>
     <name></name>
     <minimum_tab_height>10</minimum_tab_height>
+    <tab_2_title>PLC</tab_2_title>
     <tab_0_font>
       <opifont.name fontName="Cantarell" height="11" style="0">Default</opifont.name>
     </tab_0_font>
+    <tab_2_background_color>
+      <color red="255" green="255" blue="255" />
+    </tab_2_background_color>
     <tab_0_title>SCANNING</tab_0_title>
     <tab_1_foreground_color>
       <color red="0" green="0" blue="0" />
     </tab_1_foreground_color>
     <tab_1_title>DTACQ</tab_1_title>
     <scripts />
-    <tab_count>2</tab_count>
+    <tab_count>3</tab_count>
     <scale_options>
       <width_scalable>true</width_scalable>
       <height_scalable>true</height_scalable>
@@ -127,7 +139,7 @@
       <macros>
         <include_parent_macros>true</include_parent_macros>
       </macros>
-      <visible>true</visible>
+      <visible>false</visible>
       <border_color>
         <color red="0" green="128" blue="255" />
       </border_color>
@@ -599,7 +611,7 @@ $(pv_value)</tooltip>
               <keep_wh_ratio>false</keep_wh_ratio>
             </scale_options>
             <visible>true</visible>
-            <pv_name>LNS-ISRC-010:CARD0:MBBOSAMPLINGRATE</pv_name>
+            <pv_name>LNS-ISRC-010:CARD0:MBBOSAMPLINGRATE-RB</pv_name>
             <vertical_alignment>1</vertical_alignment>
             <border_color>
               <color red="0" green="128" blue="255" />
@@ -801,7 +813,7 @@ $(pv_value)</tooltip>
             <actions hook="false" hook_all="false" />
             <border_style>3</border_style>
             <forecolor_alarm_sensitive>false</forecolor_alarm_sensitive>
-            <enabled>false</enabled>
+            <enabled>true</enabled>
             <wuid>-20a75393:15809f6e4ee:-6fea</wuid>
             <transparent>false</transparent>
             <scripts />
@@ -898,7 +910,7 @@ $(pv_value)</tooltip>
             <actions hook="false" hook_all="false" />
             <border_style>3</border_style>
             <forecolor_alarm_sensitive>false</forecolor_alarm_sensitive>
-            <enabled>false</enabled>
+            <enabled>true</enabled>
             <wuid>-20a75393:15809f6e4ee:-6fe8</wuid>
             <transparent>false</transparent>
             <scripts />
@@ -995,7 +1007,7 @@ $(pv_value)</tooltip>
             <actions hook="false" hook_all="false" />
             <border_style>3</border_style>
             <forecolor_alarm_sensitive>false</forecolor_alarm_sensitive>
-            <enabled>false</enabled>
+            <enabled>true</enabled>
             <wuid>-20a75393:15809f6e4ee:-6fe6</wuid>
             <transparent>false</transparent>
             <scripts />
@@ -1052,7 +1064,7 @@ $(pv_value)</tooltip>
             <actions hook="false" hook_all="false" />
             <border_style>3</border_style>
             <forecolor_alarm_sensitive>false</forecolor_alarm_sensitive>
-            <enabled>false</enabled>
+            <enabled>true</enabled>
             <wuid>-20a75393:15809f6e4ee:-6fe4</wuid>
             <transparent>false</transparent>
             <scripts />
@@ -1189,7 +1201,7 @@ $(pv_value)</tooltip>
             <actions hook="false" hook_all="false" />
             <border_style>3</border_style>
             <forecolor_alarm_sensitive>false</forecolor_alarm_sensitive>
-            <enabled>false</enabled>
+            <enabled>true</enabled>
             <wuid>-20a75393:15809f6e4ee:-6fa2</wuid>
             <transparent>false</transparent>
             <scripts />
@@ -3887,20 +3899,18 @@ $(pv_value)</tooltip>
         <push_action_index>0</push_action_index>
         <rules>
           <rule name="Enable" prop_id="enabled" out_exp="false">
-            <exp bool_exp="pv0 &gt;= 200">
-              <value>false</value>
-            </exp>
-            <exp bool_exp="pv0&lt;=200">
+            <exp bool_exp="pv0==0 &amp;&amp; pv1==0 &amp;&amp; pv2==0 &amp;&amp; pv3==0 &amp;&amp; pv4==0 &amp;&amp; pv5==0">
               <value>true</value>
             </exp>
-            <exp bool_exp="pv1==0">
-              <value>true</value>
-            </exp>
-            <exp bool_exp="pv1==1">
+            <exp bool_exp="pv0==1 || pv0==0 || pv1==0 || pv2==0 || pv3==0 || pv4==0 || pv5==0">
               <value>false</value>
             </exp>
-            <pv trig="true">${PREFIX_SCAN}:$(NAME_MTR).P4SI</pv>
             <pv trig="true">${PREFIX_SCAN}:$(NAME_MTR).BUSY</pv>
+            <pv trig="true">INFN-SRC:INTK-HMI:FM1</pv>
+            <pv trig="true">INFN-SRC:INTK-HMI:FM2</pv>
+            <pv trig="true">INFN-SRC:INTK-HMI:FM3</pv>
+            <pv trig="true">INFN-SRC:INTK-HMI:FM4</pv>
+            <pv trig="true">INFN-SRC:INTK-HMI:FM5</pv>
           </rule>
         </rules>
         <enabled>true</enabled>
@@ -7548,7 +7558,7 @@ $(pv_value)</tooltip>
                 <pv trig="true">${PREFIX_SCAN}:$(NAME_MTR).P4SI</pv>
               </rule>
             </rules>
-            <enabled>true</enabled>
+            <enabled>false</enabled>
             <wuid>60f6e55b:158baae9c78:-7f11</wuid>
             <pv_value />
             <text>HORIZONTAL</text>
@@ -7718,7 +7728,7 @@ $(pv_value)</tooltip>
                 <pv trig="true">${PREFIX_SCAN}:$(NAME_MTR).P4SI</pv>
               </rule>
             </rules>
-            <enabled>true</enabled>
+            <enabled>false</enabled>
             <wuid>60f6e55b:158baae9c78:-7f0e</wuid>
             <pv_value />
             <text>VERTICAL</text>
@@ -7803,6 +7813,78 @@ $(pv_value)</tooltip>
               <opifont.name fontName="OpenSans" height="10" style="1">Small Bold</opifont.name>
             </font>
           </widget>
+          <widget typeId="org.csstudio.opibuilder.widgets.Rectangle" version="1.0.0">
+            <border_style>0</border_style>
+            <forecolor_alarm_sensitive>false</forecolor_alarm_sensitive>
+            <line_width>4</line_width>
+            <horizontal_fill>true</horizontal_fill>
+            <alarm_pulsing>false</alarm_pulsing>
+            <tooltip>$(pv_name)
+$(pv_value)</tooltip>
+            <rules>
+              <rule name="Visible" prop_id="visible" out_exp="false">
+                <exp bool_exp="pv0==1 || pv1==1||pv2==1||pv3==1||pv4==1">
+                  <value>false</value>
+                </exp>
+                <exp bool_exp="pv0==0 &amp;&amp; pv1==0 &amp;&amp; pv2==0 &amp;&amp; pv3==0 &amp;&amp; pv4==0">
+                  <value>true</value>
+                </exp>
+                <pv trig="true">INFN-SRC:INTK-HMI:FM1</pv>
+                <pv trig="true">INFN-SRC:INTK-HMI:FM2</pv>
+                <pv trig="true">INFN-SRC:INTK-HMI:FM3</pv>
+                <pv trig="true">INFN-SRC:INTK-HMI:FM4</pv>
+                <pv trig="true">INFN-SRC:INTK-HMI:FM5</pv>
+              </rule>
+            </rules>
+            <enabled>true</enabled>
+            <wuid>-25f0d7e:158d972c59b:-7f2b</wuid>
+            <transparent>true</transparent>
+            <pv_value />
+            <alpha>255</alpha>
+            <bg_gradient_color>
+              <color red="255" green="255" blue="255" />
+            </bg_gradient_color>
+            <scripts />
+            <border_alarm_sensitive>false</border_alarm_sensitive>
+            <height>265</height>
+            <border_width>1</border_width>
+            <scale_options>
+              <width_scalable>true</width_scalable>
+              <height_scalable>true</height_scalable>
+              <keep_wh_ratio>false</keep_wh_ratio>
+            </scale_options>
+            <visible>true</visible>
+            <pv_name></pv_name>
+            <gradient>false</gradient>
+            <border_color>
+              <color name="Major" red="255" green="0" blue="0" />
+            </border_color>
+            <anti_alias>true</anti_alias>
+            <line_style>0</line_style>
+            <widget_type>Rectangle</widget_type>
+            <fg_gradient_color>
+              <color red="255" green="255" blue="255" />
+            </fg_gradient_color>
+            <backcolor_alarm_sensitive>false</backcolor_alarm_sensitive>
+            <background_color>
+              <color name="Major" red="255" green="0" blue="0" />
+            </background_color>
+            <width>295</width>
+            <x>12</x>
+            <name>Rectangle</name>
+            <y>6</y>
+            <fill_level>0.0</fill_level>
+            <foreground_color>
+              <color red="255" green="0" blue="0" />
+            </foreground_color>
+            <actions hook="false" hook_all="false" />
+            <font>
+              <opifont.name fontName="Cantarell" height="11" style="0">Default</opifont.name>
+            </font>
+            <line_color>
+              <color name="Major" red="255" green="0" blue="0" />
+            </line_color>
+          </widget>
         </widget>
       </widget>
       <widget typeId="org.csstudio.opibuilder.widgets.ActionButton" version="2.0.0">
@@ -7813,12 +7895,35 @@ $(pv_value)</tooltip>
         <tooltip>$(pv_name)
 $(pv_value)</tooltip>
         <push_action_index>0</push_action_index>
-        <rules />
+        <rules>
+          <rule name="Enable" prop_id="enabled" out_exp="false">
+            <exp bool_exp="pv0==0 &amp;&amp; pv1==0">
+              <value>true</value>
+            </exp>
+            <exp bool_exp="pv0==1 || pv1==1">
+              <value>false</value>
+            </exp>
+            <pv trig="true">${PREFIX_SCAN}:$(NAME_MTR).BUSY</pv>
+            <pv trig="true">${PREFIX_SCAN}:$(PS).BUSY</pv>
+          </rule>
+        </rules>
         <enabled>true</enabled>
         <wuid>-61dcfd6b:158bac54bbd:-7a9a</wuid>
         <pv_value />
         <text>Extract DATA</text>
-        <scripts />
+        <scripts>
+          <path pathString="ExtracData.py" checkConnect="true" sfe="false" seoe="false">
+            <pv trig="true">loc://StartExtract</pv>
+            <pv trig="false">${PREFIX_SCAN}:$(NAME_PS).NPTS</pv>
+            <pv trig="false">${PREFIX_SCAN}:$(NAME_MTR).NPTS</pv>
+            <pv trig="false">${PREFIX_SCAN}:${CALC}-Energy-SP</pv>
+            <pv trig="false">LNS-ISRC-010:CARD0:MBBOSAMPLINGRATE-RB</pv>
+            <pv trig="false">${PREFIX_SCAN}:$(NAME_MTR).P4SI</pv>
+            <pv trig="false">$(PREFIX_SCAN):BUFF-CURRENT</pv>
+            <pv trig="false">$(PREFIX_SCAN):BUFF-ANGLE</pv>
+            <pv trig="false">$(PREFIX_SCAN):BUFF-POS</pv>
+          </path>
+        </scripts>
         <border_alarm_sensitive>false</border_alarm_sensitive>
         <height>57</height>
         <border_width>1</border_width>
@@ -7847,11 +7952,11 @@ $(pv_value)</tooltip>
           <color red="0" green="0" blue="0" />
         </foreground_color>
         <actions hook="false" hook_all="false">
-          <action type="EXECUTE_PYTHONSCRIPT">
-            <path>CSS-ExtractDataTOTracePlot.py</path>
-            <scriptText><![CDATA[from org.csstudio.opibuilder.scriptUtil import PVUtil
-]]></scriptText>
-            <embedded>false</embedded>
+          <action type="WRITE_PV">
+            <pv_name>loc://StartExtract</pv_name>
+            <value>1</value>
+            <timeout>10</timeout>
+            <confirm_message></confirm_message>
             <description></description>
           </action>
         </actions>
@@ -10014,6 +10119,324 @@ $(trace_0_y_pv_value)</tooltip>
         </foreground_color>
       </widget>
     </widget>
+    <widget typeId="org.csstudio.opibuilder.widgets.groupingContainer" version="1.0.0">
+      <border_style>0</border_style>
+      <tooltip></tooltip>
+      <rules />
+      <enabled>true</enabled>
+      <wuid>-25f0d7e:158d972c59b:-7efc</wuid>
+      <transparent>true</transparent>
+      <lock_children>false</lock_children>
+      <scripts />
+      <height>1130</height>
+      <border_width>1</border_width>
+      <scale_options>
+        <width_scalable>true</width_scalable>
+        <height_scalable>true</height_scalable>
+        <keep_wh_ratio>false</keep_wh_ratio>
+      </scale_options>
+      <macros>
+        <include_parent_macros>true</include_parent_macros>
+      </macros>
+      <visible>true</visible>
+      <border_color>
+        <color red="0" green="128" blue="255" />
+      </border_color>
+      <widget_type>Grouping Container</widget_type>
+      <background_color>
+        <color red="240" green="240" blue="240" />
+      </background_color>
+      <width>2489</width>
+      <x>1</x>
+      <name>PLC</name>
+      <y>1</y>
+      <foreground_color>
+        <color red="192" green="192" blue="192" />
+      </foreground_color>
+      <actions hook="false" hook_all="false" />
+      <fc>false</fc>
+      <show_scrollbar>true</show_scrollbar>
+      <font>
+        <opifont.name fontName="Cantarell" height="11" style="0">Default</opifont.name>
+      </font>
+      <widget typeId="org.csstudio.opibuilder.widgets.linkingContainer" version="1.0.0">
+        <opi_file></opi_file>
+        <border_style>3</border_style>
+        <tooltip></tooltip>
+        <rules />
+        <enabled>true</enabled>
+        <wuid>-25f0d7e:158d972c59b:-7e2e</wuid>
+        <scripts>
+          <path pathString="/CSS/emu/Scripts/PlcOpi.js" checkConnect="true" sfe="false" seoe="false">
+            <pv trig="true">loc://pagePLC</pv>
+          </path>
+        </scripts>
+        <height>1060</height>
+        <border_width>1</border_width>
+        <scale_options>
+          <width_scalable>true</width_scalable>
+          <height_scalable>true</height_scalable>
+          <keep_wh_ratio>false</keep_wh_ratio>
+        </scale_options>
+        <macros>
+          <include_parent_macros>true</include_parent_macros>
+        </macros>
+        <resize_behaviour>0</resize_behaviour>
+        <visible>true</visible>
+        <group_name></group_name>
+        <border_color>
+          <color red="0" green="128" blue="255" />
+        </border_color>
+        <widget_type>Linking Container</widget_type>
+        <background_color>
+          <color name="Container Grey" red="200" green="200" blue="200" />
+        </background_color>
+        <width>2011</width>
+        <x>414</x>
+        <name>Linking Container</name>
+        <y>27</y>
+        <foreground_color>
+          <color red="192" green="192" blue="192" />
+        </foreground_color>
+        <actions hook="false" hook_all="false" />
+        <font>
+          <opifont.name fontName="Cantarell" height="11" style="0">Default</opifont.name>
+        </font>
+      </widget>
+      <widget typeId="org.csstudio.opibuilder.widgets.ActionButton" version="2.0.0">
+        <toggle_button>false</toggle_button>
+        <border_style>14</border_style>
+        <forecolor_alarm_sensitive>false</forecolor_alarm_sensitive>
+        <alarm_pulsing>false</alarm_pulsing>
+        <tooltip>$(pv_name)</tooltip>
+        <push_action_index>0</push_action_index>
+        <rules>
+          <rule name="Rule_fault_mode_1,2and3" prop_id="background_color" out_exp="false">
+            <exp bool_exp="pv0 == 1 || pv1==1 ||pv2==1">
+              <value>
+                <color name="Major" red="255" green="0" blue="0" />
+              </value>
+            </exp>
+            <pv trig="true">INFN-SRC:INTK-HMI:FM1</pv>
+            <pv trig="true">INFN-SRC:INTK-HMI:FM2</pv>
+            <pv trig="true">INFN-SRC:INTK-HMI:FM3</pv>
+          </rule>
+        </rules>
+        <enabled>true</enabled>
+        <wuid>-25f0d7e:158d972c59b:-7d3b</wuid>
+        <pv_value />
+        <text>Fault mode 1, 2 and 3</text>
+        <scripts />
+        <border_alarm_sensitive>false</border_alarm_sensitive>
+        <height>70</height>
+        <border_width>0</border_width>
+        <scale_options>
+          <width_scalable>true</width_scalable>
+          <height_scalable>true</height_scalable>
+          <keep_wh_ratio>false</keep_wh_ratio>
+        </scale_options>
+        <image></image>
+        <visible>true</visible>
+        <pv_name></pv_name>
+        <border_color>
+          <color red="255" green="255" blue="255" />
+        </border_color>
+        <widget_type>Action Button</widget_type>
+        <backcolor_alarm_sensitive>false</backcolor_alarm_sensitive>
+        <background_color>
+          <color red="211" green="215" blue="207" />
+        </background_color>
+        <width>360</width>
+        <x>12</x>
+        <name>Action Button</name>
+        <y>102</y>
+        <style>0</style>
+        <foreground_color>
+          <color name="Black" red="0" green="0" blue="0" />
+        </foreground_color>
+        <actions hook="false" hook_all="false">
+          <action type="WRITE_PV">
+            <pv_name>loc://pagePLC</pv_name>
+            <value>fm123</value>
+            <timeout>10</timeout>
+            <confirm_message></confirm_message>
+            <description></description>
+          </action>
+        </actions>
+        <font>
+          <fontdata fontName="Monospace" height="19" style="1" />
+        </font>
+      </widget>
+      <widget typeId="org.csstudio.opibuilder.widgets.ActionButton" version="2.0.0">
+        <toggle_button>false</toggle_button>
+        <border_style>14</border_style>
+        <forecolor_alarm_sensitive>false</forecolor_alarm_sensitive>
+        <alarm_pulsing>false</alarm_pulsing>
+        <tooltip>$(pv_name)</tooltip>
+        <push_action_index>0</push_action_index>
+        <rules>
+          <rule name="Rule_fault_mode4and5" prop_id="background_color" out_exp="false">
+            <exp bool_exp="pv0==1 || pv1==1">
+              <value>
+                <color name="Major" red="255" green="0" blue="0" />
+              </value>
+            </exp>
+            <pv trig="true">INFN-SRC:INTK-HMI:FM5</pv>
+            <pv trig="true">INFN-SRC:INTK-HMI:FM4</pv>
+          </rule>
+        </rules>
+        <enabled>true</enabled>
+        <wuid>-25f0d7e:158d972c59b:-7d3a</wuid>
+        <pv_value />
+        <text>Fault mode 4 and 5</text>
+        <scripts />
+        <border_alarm_sensitive>false</border_alarm_sensitive>
+        <height>70</height>
+        <border_width>0</border_width>
+        <scale_options>
+          <width_scalable>true</width_scalable>
+          <height_scalable>true</height_scalable>
+          <keep_wh_ratio>false</keep_wh_ratio>
+        </scale_options>
+        <image></image>
+        <visible>true</visible>
+        <pv_name></pv_name>
+        <border_color>
+          <color red="255" green="255" blue="255" />
+        </border_color>
+        <widget_type>Action Button</widget_type>
+        <backcolor_alarm_sensitive>false</backcolor_alarm_sensitive>
+        <background_color>
+          <color red="211" green="215" blue="207" />
+        </background_color>
+        <width>360</width>
+        <x>12</x>
+        <name>Action Button_10</name>
+        <y>177</y>
+        <style>0</style>
+        <foreground_color>
+          <color name="Black" red="0" green="0" blue="0" />
+        </foreground_color>
+        <actions hook="false" hook_all="false">
+          <action type="WRITE_PV">
+            <pv_name>loc://pagePLC</pv_name>
+            <value>fm45</value>
+            <timeout>10</timeout>
+            <confirm_message></confirm_message>
+            <description></description>
+          </action>
+        </actions>
+        <font>
+          <fontdata fontName="Monospace" height="18" style="1" />
+        </font>
+      </widget>
+      <widget typeId="org.csstudio.opibuilder.widgets.ActionButton" version="2.0.0">
+        <toggle_button>false</toggle_button>
+        <border_style>14</border_style>
+        <forecolor_alarm_sensitive>false</forecolor_alarm_sensitive>
+        <alarm_pulsing>false</alarm_pulsing>
+        <tooltip>$(pv_name)</tooltip>
+        <push_action_index>0</push_action_index>
+        <rules />
+        <enabled>true</enabled>
+        <wuid>-25f0d7e:158d972c59b:-7d39</wuid>
+        <pv_value />
+        <text>Home</text>
+        <scripts />
+        <border_alarm_sensitive>false</border_alarm_sensitive>
+        <height>70</height>
+        <border_width>0</border_width>
+        <scale_options>
+          <width_scalable>true</width_scalable>
+          <height_scalable>true</height_scalable>
+          <keep_wh_ratio>false</keep_wh_ratio>
+        </scale_options>
+        <image></image>
+        <visible>true</visible>
+        <pv_name>loc://pagePLC("home")</pv_name>
+        <border_color>
+          <color red="255" green="255" blue="255" />
+        </border_color>
+        <widget_type>Action Button</widget_type>
+        <backcolor_alarm_sensitive>false</backcolor_alarm_sensitive>
+        <background_color>
+          <color red="211" green="215" blue="207" />
+        </background_color>
+        <width>360</width>
+        <x>12</x>
+        <name>Action Button_6</name>
+        <y>27</y>
+        <style>0</style>
+        <foreground_color>
+          <color name="Black" red="0" green="0" blue="0" />
+        </foreground_color>
+        <actions hook="false" hook_all="false">
+          <action type="WRITE_PV">
+            <pv_name>loc://pagePLC</pv_name>
+            <value>home</value>
+            <timeout>10</timeout>
+            <confirm_message></confirm_message>
+            <description></description>
+          </action>
+        </actions>
+        <font>
+          <fontdata fontName="Monospace" height="18" style="1" />
+        </font>
+      </widget>
+      <widget typeId="org.csstudio.opibuilder.widgets.ActionButton" version="2.0.0">
+        <toggle_button>false</toggle_button>
+        <border_style>14</border_style>
+        <forecolor_alarm_sensitive>false</forecolor_alarm_sensitive>
+        <alarm_pulsing>false</alarm_pulsing>
+        <tooltip>$(pv_name)</tooltip>
+        <push_action_index>0</push_action_index>
+        <rules />
+        <enabled>true</enabled>
+        <wuid>-25f0d7e:158d972c59b:-7d38</wuid>
+        <pv_value />
+        <text>Inputs/outputs value</text>
+        <scripts />
+        <border_alarm_sensitive>false</border_alarm_sensitive>
+        <height>70</height>
+        <border_width>0</border_width>
+        <scale_options>
+          <width_scalable>true</width_scalable>
+          <height_scalable>true</height_scalable>
+          <keep_wh_ratio>false</keep_wh_ratio>
+        </scale_options>
+        <image></image>
+        <visible>true</visible>
+        <pv_name></pv_name>
+        <border_color>
+          <color red="255" green="255" blue="255" />
+        </border_color>
+        <widget_type>Action Button</widget_type>
+        <backcolor_alarm_sensitive>false</backcolor_alarm_sensitive>
+        <background_color>
+          <color red="211" green="215" blue="207" />
+        </background_color>
+        <width>360</width>
+        <x>12</x>
+        <name>Action Button_13</name>
+        <y>252</y>
+        <style>0</style>
+        <foreground_color>
+          <color name="Black" red="0" green="0" blue="0" />
+        </foreground_color>
+        <actions hook="false" hook_all="false">
+          <action type="WRITE_PV">
+            <pv_name>loc://pagePLC</pv_name>
+            <value>InOut</value>
+            <timeout>10</timeout>
+            <confirm_message></confirm_message>
+            <description></description>
+          </action>
+        </actions>
+        <font>
+          <fontdata fontName="Monospace" height="18" style="1" />
+        </font>
+      </widget>
+    </widget>
   </widget>
   <widget typeId="org.csstudio.opibuilder.widgets.Rectangle" version="1.0.0">
     <border_style>0</border_style>
@@ -10081,10 +10504,10 @@ $(pv_value)</tooltip>
     <enabled>false</enabled>
     <wuid>20cc570d:152c6318c71:-19d2</wuid>
     <transparent>true</transparent>
-    <auto_size>true</auto_size>
-    <text>EMU</text>
+    <auto_size>false</auto_size>
+    <text>EMITTANCE METER</text>
     <scripts />
-    <height>39</height>
+    <height>43</height>
     <border_width>2</border_width>
     <scale_options>
       <width_scalable>true</width_scalable>
@@ -10101,17 +10524,17 @@ $(pv_value)</tooltip>
     <background_color>
       <color name="IO Background" red="255" green="255" blue="205" />
     </background_color>
-    <width>73</width>
-    <x>475</x>
+    <width>2491</width>
+    <x>18</x>
     <name>Label Template</name>
-    <y>20</y>
+    <y>18</y>
     <foreground_color>
       <color red="255" green="255" blue="255" />
     </foreground_color>
     <actions hook="false" hook_all="false" />
     <show_scrollbar>false</show_scrollbar>
     <font>
-      <fontdata fontName="Titillium" height="25" style="0" />
+      <fontdata fontName="Titillium" height="28" style="0" />
     </font>
   </widget>
   <widget typeId="org.csstudio.opibuilder.widgets.Label" version="1.0.0">
@@ -10142,8 +10565,8 @@ $(pv_value)</tooltip>
     <background_color>
       <color name="IO Background" red="255" green="255" blue="205" />
     </background_color>
-    <width>115</width>
-    <x>666</x>
+    <width>79</width>
+    <x>2088</x>
     <name>Label Orientation_7</name>
     <y>30</y>
     <foreground_color>
@@ -10200,7 +10623,7 @@ $(pv_value)</tooltip>
       <color name="Black" red="0" green="0" blue="0" />
     </background_color>
     <width>322</width>
-    <x>780</x>
+    <x>2172</x>
     <y>27</y>
     <maximum>1.7976931348623157E308</maximum>
     <foreground_color>
diff --git a/opi/Scripts/PlcOpi.js b/opi/Scripts/PlcOpi.js
new file mode 100644
index 0000000..0c3a04a
--- /dev/null
+++ b/opi/Scripts/PlcOpi.js
@@ -0,0 +1,19 @@
+importPackage(Packages.org.csstudio.opibuilder.scriptUtil);
+
+var pv0 = PVUtil.getString(pvs[0]);
+
+if (pv0 == "home") {
+	widget.setPropertyValue("opi_file", "");
+	widget.setPropertyValue("opi_file", "/CSS/emu-plc-test/1-Home.opi");
+} else if (pv0 == "fm123") {
+	widget.setPropertyValue("opi_file", "");
+	widget.setPropertyValue("opi_file", "/CSS/emu-plc-test/2-FM1,2,3.opi");
+} else if (pv0 == "fm45") {
+	widget.setPropertyValue("opi_file", "");
+	widget.setPropertyValue("opi_file", "/CSS/emu-plc-test/3-FM4,5.opi");
+} else if (pv0 == "InOut") {
+	widget.setPropertyValue("opi_file", "");
+	widget.setPropertyValue("opi_file", "/CSS/emu-plc-test/4-Inout_value.opi");
+} else {
+	pv0 = "home";
+}
\ No newline at end of file
-- 
GitLab