Announcement

Collapse
No announcement yet.

Select Case Error

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

    Select Case Error

    Hi All,

    It is probobly a newbie mistake, but hoping someone might be able to take a look at my Script point out where the error is. When i run the script i get

    5/13/2012 2:22:28 PM - Error - Script compile error: ')' expected.on line 16

    The idea is basically to compare the windspeed to the appropiate textual category, and give the device a value to represent the category.

    Thanks!

    Code:
    Sub main(params as object)
    
    Select Case cDBL(hs.DeviceValue("_45"))
    
    Case 0 to 1
    hs.Writelog("Cumulus - Wind (Cranbourne)", "Wind: CALM") 
    hs.SetDeviceValue("Z95",0)
    
    
    Case 1.1 to 5.9
    hs.SetDeviceValue("Z95",1)
    hs.SetDeviceString("Z95", "Light Air", True)
    
    
    Case 6 to 11.9
    hs.SetDeviceValue("Z95",2)
    hs.SetDeviceString("Z95", "Light Breeze", True)
    
    
    Case 12 to 19
    hs.SetDeviceValue("Z95",3)
    hs.SetDeviceString("Z95", "Gentle Breeze", True)
    
    
    Case 20 to 28
    hs.SetDeviceValue("Z95",4)
    hs.SetDeviceString("Z95", "Moderate Breeze", True)
    
    
    Case 29 to 38
    hs.SetDeviceValue("Z95",5)
    hs.SetDeviceString("Z95", "Fresh Breeze", True)
    
    
    Case 39 to 49
    hs.SetDeviceValue("Z95",6)
    hs.SetDeviceString("Z95", "Strong Breeze", True)
    
    
    Case 50 to 61
    hs.SetDeviceValue("Z95",7)
    hs.SetDeviceString("Z95", "Moderate or Near Gale", True)
    
    
    Case 62 to 74
    hs.SetDeviceValue("Z95",8)
    hs.SetDeviceString("Z95", "Gale or Fresh Gale", True)
    
    
    Case 75 to 88
    hs.SetDeviceValue("Z95",9)
    hs.SetDeviceString("Z95", "Strong Gale", True)
    
    
    Case 89 to 102
    hs.SetDeviceValue("Z95",10)
    hs.SetDeviceString("Z95", "Whole Gale or Storm", True)
    
    
    Case 103 to 117
    hs.SetDeviceValue("Z95",11)
    hs.SetDeviceString("Z95", "Violent Storm", True)
    
    
    Case 118 to 153
    hs.SetDeviceValue("Z95",12)
    hs.SetDeviceString("Z95", "Hurricane - Cat 1", True)
    
    
    Case 154 to 177
    hs.SetDeviceValue("Z95",13)
    hs.SetDeviceString("Z95", "Hurricane - Cat 2", True)
    
    
    Case 178 to 209
    hs.SetDeviceValue("Z95",14)
    hs.SetDeviceString("Z95", "Hurricane - Cat 3", True)
    
    
    Case 210 to 249
    hs.SetDeviceValue("Z95",15)
    hs.SetDeviceString("Z95", "Hurricane - Cat 4", True)
    
    
    Case 250 to 1000
    hs.SetDeviceValue("Z95",16)
    hs.SetDeviceString("Z95", "Hurricane - Cat 5", True)
    
    
    Case Else
    hs.SetDeviceValue("Z95",99)
    hs.SetDeviceString("Z95", "Error determining Wind Category", True)
    
    
    End Select
    End Sub
    HS3 PRO, Win10, WeatherXML, HSTouch, Pushover, UltraGCIR, Heaps of Jon00 Plugins, Just sold and about to move so very slim system.

    Facebook | Twitter | Flickr | Google+ | Website | YouTube

    #2
    Solved, i wasn't running it with noargs
    HS3 PRO, Win10, WeatherXML, HSTouch, Pushover, UltraGCIR, Heaps of Jon00 Plugins, Just sold and about to move so very slim system.

    Facebook | Twitter | Flickr | Google+ | Website | YouTube

    Comment


      #3
      Change it to

      Sub Main(....
      huggy_d1

      Automating made easy

      Comment

      Working...
      X