KB-41736: Script error when writing on a tag.

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

Print Friendly, PDF & Email

Este artigo foi útil? Was this helpful?

Classificação média - Average rating 0 / 5. Count: 0

Leave a Reply

Your email address will not be published.Required fields are marked *