Announcement

Collapse
No announcement yet.

Anyone know what is wrong with this scrpt.

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

    Anyone know what is wrong with this scrpt.

    Anyone spot what is wring with this script?
    Code:
    Sub Main
    dim A
    Dim  B
    dim C
    A="Landy has moved to $$DSR:1083:"
    C = Len(A)
    B = (left(A,C-31))
    hs.speak B
     End Sub
    thanks
    sigpic
    A founder member of "The HA Pioneer Group" otherwise known as the "Old farts club!"

    #2
    You cannot use replacement variables directly in scripts.

    This should work:

    PHP Code:
        Sub Main()
            
    Dim A
            Dim B
            Dim C
            A 
    "Landy has moved to " hs.ReplaceVariables("$$DSR:1083:")
            
    Len(A)
            
    = (Microsoft.VisualBasic.Left(A31))
            
    hs.speak(B)
        
    End Sub 
    Jon

    Comment


      #3
      Originally posted by jon00 View Post
      You cannot use replacement variables directly in scripts.

      This should work:

      PHP Code:
          Sub Main()
              
      Dim A
              Dim B
              Dim C
              A 
      "Landy has moved to " hs.ReplaceVariables("$$DSR:1083:")
              
      Len(A)
              
      = (Microsoft.VisualBasic.Left(A31))
              
      hs.speak(B)
          
      End Sub 
      Thanks Jon,

      another thing gone from HS2, unfortunately your suggestion errors,
      Running script, script run or compile error in file: C:/Program Files/HomeSeer HS3/scripts/Landy moved.txt424:Object required: 'Microsoft' in line 7 More info: Object required: 'Microsoft'
      sigpic
      A founder member of "The HA Pioneer Group" otherwise known as the "Old farts club!"

      Comment


        #4
        Sorry I forgot to remove that bit as you are running this in VBScript:

        B = (Microsoft.VisualBasic.Left(A, C - 31))

        becomes

        B = (Left(A, C - 31))
        Jon

        Comment


          #5
          Thanks Jon, works perfectly, lots of script editing to do now.

          Appreciate your help.
          sigpic
          A founder member of "The HA Pioneer Group" otherwise known as the "Old farts club!"

          Comment

          Working...
          X