Announcement

Collapse
No announcement yet.

Event immediate Script help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Event immediate Script help

    I am trying to write to the log, the current value of a device.

    I am using the below test string in the immediate execute script event (undertand it is not the device value .. but a test to convert numeric to string).


    &hs.WriteLog ("TEST", Convert.ToString(158))

    Ultimately, I want to get the value of device # 158, but I understand that the values for devices are always numeric .. thus the reason for convert to string.

    If you know how to get this device's value to display in the log .. if you can provide the syntax, I would appreciate it ..

    tanx .. Don

    #2
    Originally posted by djbeam View Post
    I am trying to write to the log, the current value of a device.

    I am using the below test string in the immediate execute script event (undertand it is not the device value .. but a test to convert numeric to string).


    &hs.WriteLog ("TEST", Convert.ToString(158))

    Ultimately, I want to get the value of device # 158, but I understand that the values for devices are always numeric .. thus the reason for convert to string.

    If you know how to get this device's value to display in the log .. if you can provide the syntax, I would appreciate it ..

    tanx .. Don
    For the most part you can get away without needing to explicitly convert some things, if you try and put a boolean value into a call that accepts a string it will convert it automatically to a string and print True/False. Anything that it can't convert automatically it will complain and error giving a type conversion error.

    You should be able to do what you are after by;

    &hs.writelog("Test", hs.devicevalueex(158))

    hs.devicevalueex returns the value in the form of a double not an integer but it will still automatically turn it into a string for you.

    Comment

    Working...
    X