Question:
When there is no communication with the device, why does WriteEx() method not return script errors, unlike a regular write on tag, which always returns this type of error?
Solution:
WriteEx() method “predicts” the communication error. It returns TRUE or FALSE, according to the writing’s success. Below there is an example of script:
aux = Application.GetObject(“Driver1.Tag1”).WriteEx(1)
If aux = TRUE then
MsgBox “Writing succeeded.”
Else
MsgBox “Writing failed.”
End If
On the other hand, regular writing operations, when not successful, return a script error.
Application.GetObject(“Driver2.Tag1”).Value = 1