I am wondering if anyone can help me with the updatevalue function when used in a VBS script (.vbs file)
I can get this working in VBA no problem but think there must be something simple I am missing in VBS....forgive the messy code this is just me trying to get it to work. I have tried just passing text and a 0 to the updatevalue function, no joy, and then defining a PIValue object and PITimestamp. I always get a "Type Mismatch" error. Anyone have any ideas? The reason for doing this in vbs is to keep things as simple and portable as possible....
Dim ptmTimestamp DIM pvValueToAdd Dim ptPIPoint Dim mySDK Dim myServer Set mySDK = CreateObject("PISDK.PISDK") Set myServer = mySDK.Servers("PISRV001") myValue = "Normal" myTag = "testTag.DIG" SET ptmTimestamp = CreateObject("PITimeServer.PITimeFormat") SET pvValueToAdd = CreateObject("PISDK.PIValue") SET ptPIPoint = myServer.PIPoints(myTag) ptmTimestamp.InputString = "*" Set pvValueToAdd.TimeStamp = ptmTimestamp pvValueToAdd.Value = myValue msgbox(pvValueToAdd.Timestamp) msgbox(pvValueToAdd.Value) ptPIPoint.Data.UpdateValue pvValueToAdd,0 msgbox("DONE") SET ptPIPoint = Nothing Set myServer = Nothing Set mySDK = Nothing