Announcement

Collapse
No announcement yet.

script error on "As New Date" command - Solved!

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

    script error on "As New Date" command - Solved!

    I'm new to scripting world, so please be comprehensive...

    I'm trying to develop a script for a reminder on my garbage and recycling day and I'm struggling with a simple script line that always generate a error in the log files saying that somethig is missing in the command.

    here is my complete script file content:

    sub main
    Dim startDateRecycle As New Date(2016, 4, 13)
    If DateDiff("d", startDateRecycle, compareDate) Mod 14 = 0 Then
    hs.speak("Tomorrow is recycling day. ", true)
    End If
    End Sub

    I always have the following message in the log file:

    Running script, script run or compile error in file: C:/Program Files (x86)/HomeSeer HS3/scripts/vidanges.txt1025:waiting for instruction end in line 2 More info: waiting for end of instruction

    Can someone point me to my mistake

    thanks
    Last edited by goldriver; April 13, 2016, 01:47 PM.

    #2
    Originally posted by goldriver View Post
    I'm new to scripting world, so please be comprehensive...

    I'm trying to develop a script for a reminder on my garbage and recycling day and I'm struggling with a simple script line that always generate a error in the log files saying that somethig is missing in the command.

    here is my complete script file content:

    sub main
    Dim startDateRecycle As New Date(2016, 4, 13)
    If DateDiff("d", startDateRecycle, compareDate) Mod 14 = 0 Then
    hs.speak("Tomorrow is recycling day. ", true)
    End If
    End Sub

    I always have the following message in the log file:

    Running script, script run or compile error in file: C:/Program Files (x86)/HomeSeer HS3/scripts/vidanges.txt1025:waiting for instruction end in line 2 More info: waiting for end of instruction

    Can someone point me to my mistake

    thanks
    For any newbie's to scripting like me, I hope my finding will help

    I replaced the:
    "Dim startDateRecycle As New Date(2016, 4, 13)"

    with

    "Dim startDateRecycle
    startDateRecycle = DateSerial(2016,4,13)"

    I guess my mistake was to copy the original script from a post I found ... after looking in MSDN scripting documentation, I found how to fix my problem.

    Comment

    Working...
    X