Announcement

Collapse
No announcement yet.

Copy status grapich from one device to another

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

    #16
    One possible solution to the original question......

    If I have a bunch of devices and I want to set all the Value/Status and/or Value/Graphics pairs the same, I do it with a script that loops through the devices, removes all the existing VS / VG pairs and resets them to the desired values.

    Paul..

    Comment


      #17
      Originally posted by sooty View Post
      One possible solution to the original question......

      If I have a bunch of devices and I want to set all the Value/Status and/or Value/Graphics pairs the same, I do it with a script that loops through the devices, removes all the existing VS / VG pairs and resets them to the desired values.

      Paul..
      Can you share the script? Thx!



      Sent from my SM-G950U using Tapatalk

      Comment


        #18
        Obviously it's impossible to provide a generic script because each persons requirements will be different but the attached should give an insight of how to do it.

        This script would remove any existing VS and VG pairs for device ref's 100, 101, 102, 103, 104 and 105 and replace them with a single range V/S pair and 4 V/G pairs covering the range.

        Further info on scripting VS / VG pairs is available here

        Code:
        Sub Main(Optional ByVal Parms As String = "")
            Dim intDevices() As Integer = {100, 101, 102, 103, 104, 105}
            Dim ImagePath As String = "images\MyCustomGraphics\"
        
            Dim dvRef As Integer
            Dim vPair As VSPair
            Dim gPair As VGPair
        
            For i As Integer = 0 To ubound(intDevices)
                dvRef = intDevices(i)
        
                If hs.DeviceExistsRef(dvRef) Then
                    Try
                        hs.DeviceVSP_ClearAll(dvRef, True)
                        hs.DeviceVGP_ClearAll(dvRef, True)
        
                        vPair = New VSPair(1)
                        vPair.PairType = VSVGPairType.Range
                        vPair.RangeStart = 0
                        vPair.RangeEnd = 100
                        vPair.RangeStatusPrefix = ""
                        vPair.RangeStatusSuffix = "C"
                        vPair.RangeStatusDecimals = 1
                        vPair.IncludeValues = True
                        vPair.ValueOffset = 0
                        vPair.HasScale = False
                        vPair.HasAdditionalData = False
                        hs.DeviceVSP_AddPair(dvRef, vPair)
        
                        gPair = New VGPair
                        gPair.PairType = VSVGPairType.Range
                        gPair.RangeStart = 0
                        gPair.RangeEnd = 24.9
                        gPair.Graphic = ImagePath & "Temp_01.png"
                        hs.DeviceVGP_AddPair(dvRef, gPair)
        
                        gPair = New VGPair
                        gPair.PairType = VSVGPairType.Range
                        gPair.RangeStart = 25
                        gPair.RangeEnd = 49.9
                        gPair.Graphic = ImagePath & "Temp_02.png"
                        hs.DeviceVGP_AddPair(dvRef, gPair)
        
                        gPair = New VGPair
                        gPair.PairType = VSVGPairType.Range
                        gPair.RangeStart = 50
                        gPair.RangeEnd = 74.9
                        gPair.Graphic = ImagePath & "Temp_03.png"
                        hs.DeviceVGP_AddPair(dvRef, gPair)
        
                        gPair = New VGPair
                        gPair.PairType = VSVGPairType.Range
                        gPair.RangeStart = 75
                        gPair.RangeEnd = 100
                        gPair.Graphic = ImagePath & "Temp_04.png"
                        hs.DeviceVGP_AddPair(dvRef, gPair)
        
                        hs.SaveEventsDevices()
                        hs.WriteLog("Info", "VS/VG pairs reset complete for dvRef: " & dvRef)
        
                    Catch ex As Exception
                        hs.WriteLog("Error", "Error processing dvRef: " & dvRef & " : " & ex.message)
                    End Try
        
                Else
                    hs.WriteLog("Error", "dvRef: " & dvRef & " doesn't exist in HS!")
                End If
            Next
        
            vPair = Nothing
            gPair = Nothing
        End Sub

        Comment


          #19
          This is an old thread from the time of HS3. We are on HS4 now. Is there a resolution of the issue. Is it possible to copy/paste device settings from one device to another.

          Comment

          Working...
          X