Announcement

Collapse
No announcement yet.

Stuck on trying to get "Today" into case statement; by a scripting newbie.

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

    Stuck on trying to get "Today" into case statement; by a scripting newbie.

    OK, I am trying to get today's date and put it into either an enumeration or a string... anything I can use in a Case statement. My constant failure is at:

    Running script C:\Program Files (x86)\HomeSeer HS3\scripts\test.vb :Exception has been thrown by the target of an invocation.Public member 'DayOfWeek' on type 'hsapplication' not found.

    Can anyone give me some instruction, I'm trying to learn scripting, but it is like drinking from a firehose when starting out.

    SandieWorks.vb.txt
    HomeSeer Version: HS4 Pro Edition 4.2.18.1
    Operating System: Microsoft Windows 10 Pro - Desktop
    Z-Wave Devices via two Z-Net G3s
    Zigbee Devices via RaspBee on RPi 3b+
    WiFi Devices via Internal Router.

    Enabled Plug-Ins
    AK Weather 4.0.5.37,AmbientWeather 3.0.1.9,Big6 3.34.0.0,BLBackup 2.0.63.0,BLGData 3.0.55.0,BLLock 3.0.39.0,BLUPS 2.0.26.0,Device History 3.3.1.0,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,HSBuddy 3.30.1003.1,JowiHue 4.0.8.7,LG ThinQ 4.0.24.0,rnbWeather 4.4.0.0,SDJ-Health 3.1.1.4,TPLinkSmartHome4 2022.12.30.0,UltraCID3 3.0.6681.34300,Z-Wave 3.0.11.0 2

    #2
    For some reason, it thinks DayOfWeek is a member of hsapplication...

    Try putting System. in front of each Case statement:
    System.DayOfWeek.Monday
    instead of
    DayOfWeek.Monday
    HS4Pro Running on a Raspberry Pi4
    67 Z-Wave Nodes, 111 Events, 422 Devices
    Z-Wave, UPB, WiFi
    Plugins: EasyTrigger, weatherXML, OMNI, Z-Wave, Tuya, Device History
    HSTouch Clients: 3 Android, 1 Joggler

    Comment


      #3
      Originally posted by rmasonjr View Post
      For some reason, it thinks DayOfWeek is a member of hsapplication...
      THANK YOU! There is a DayOfWeek in HS3 scripting, but is so poorly documented, I never really could figure out exactly what it did or how to use it. No examples, either. It never seemed to do anything but throw errors. Pointing to "System." got things pointed in the right direction.

      Originally posted by rmasonjr View Post
      Try putting System. in front of each Case statement:
      System.DayOfWeek.Monday
      instead of
      DayOfWeek.Monday
      OK, so that worked perfectly, but only when I put it into a new file. I then built the "new file" into the old file by copying and pasting step by step. When I was through, the new file and old file seemed identical, but the old file never "finished," when executed. but didn't throw any errors, either. I copied the "new file" over the old file and everything works fine. I sure wish I knew what went wrong, because this is beginning to feel more like art than science. Thank you very much for your help....
      Last edited by ewkearns; September 2, 2021, 07:54 AM. Reason: Poor grammar!
      HomeSeer Version: HS4 Pro Edition 4.2.18.1
      Operating System: Microsoft Windows 10 Pro - Desktop
      Z-Wave Devices via two Z-Net G3s
      Zigbee Devices via RaspBee on RPi 3b+
      WiFi Devices via Internal Router.

      Enabled Plug-Ins
      AK Weather 4.0.5.37,AmbientWeather 3.0.1.9,Big6 3.34.0.0,BLBackup 2.0.63.0,BLGData 3.0.55.0,BLLock 3.0.39.0,BLUPS 2.0.26.0,Device History 3.3.1.0,EasyTrigger 3.0.0.76,Harmony Hub 4.0.14.0,HSBuddy 3.30.1003.1,JowiHue 4.0.8.7,LG ThinQ 4.0.24.0,rnbWeather 4.4.0.0,SDJ-Health 3.1.1.4,TPLinkSmartHome4 2022.12.30.0,UltraCID3 3.0.6681.34300,Z-Wave 3.0.11.0 2

      Comment


        #4
        No worries - we've all been there!
        HS4Pro Running on a Raspberry Pi4
        67 Z-Wave Nodes, 111 Events, 422 Devices
        Z-Wave, UPB, WiFi
        Plugins: EasyTrigger, weatherXML, OMNI, Z-Wave, Tuya, Device History
        HSTouch Clients: 3 Android, 1 Joggler

        Comment


          #5
          Trying to drink from a fire hose.....I like that. Stealing.


          Jim Speiser
          37-year veteran of Home Automation
          Still don't know squat

          Comment

          Working...
          X