/* Sample script that toggles an OPC connection between enabled and disabled * triggered by an on-change evetn. Value of point changing determined * whether the OPC connection is enabled or disabled. * Change the OPC connection name in the opcclient.setServer(XXXXX) line. * Change the point name in the .OnChange function call. */ require ("Application"); require ("OPCSupport"); class OPCReconnect Application { } method OPCReconnect.enable() { local opcclient = new OPCConnection(); opcclient.setServer("opc001"); if(value == 1) { opcclient.enable(t); } else { opcclient.enable(nil); } } method OPCReconnect.constructor () { //replace DataSim:Amplitude with the tag that will be changing .OnChange(#$default:GE.VaersaMaxSE.M0001, `(@self).enable ()); } method OPCReconnect.destructor () { } ApplicationSingleton (OPCReconnect);