Announcement

Collapse
No announcement yet.

Exception - target of invocation

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

  • Exception - target of invocation

    Recently moved HS to new PC. The script worked before but now throws error:
    Code:
    Running script C:\Program Files (x86)\HomeSeer HS3\scripts\heater.vb :Exception has been thrown by the target of an invocation.->Does entry point Main exist in script
    Simple script to log pool and spa heater run times to file:
    PHP Code:
    Sub Main(parm as object)
     
    Dim objReader As System.IO.StreamWriter
         
    Dim fullPath 
    as String "C:\Program Files\HomeSeer HS3\Logs\Heater_Run_times.txt"
             
    Try
                
    objReader = New System.IO.StreamWriter(fullPath,TRUE)
                
    objReader.WriteLine(now() &"   "hs.CAPIGetStatus(1229).Status)
                
    objReader.WriteLine(hs.CAPIGetStatus(1234).Status)
            Catch 
    Ex As Exception
                
    'System.Windows.Forms.Messagebox.show(Ex.Message)
     Finally
         objReader.Close()
            End Try
     End Sub 
    What am I not seeing?
    Larry

  • #2
    Note that all the entries after Catch are in red. I pasted your script into TenScripting and get an error on the last objReader line. It may need to go inside the Try/Catch.
    Last edited by Uncle Michael; May 25th, 2018, 02:02 PM.
    Mike____________________________________________________________ __________________
    HS3 Pro Edition 3.0.0.500

    HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF, Rain8Net+ | RFXCOM | QSE100D | Vantage Pro | Green-Eye | X10: XTB-232, -IIR | Edgeport/8 | Way2Call | Ecobee3

    Comment


    • #3
      Is it as simple as changing the program directory to match (add the x86) where it's installed on the new PC?
      >Running script C:\Program Files (x86)\HomeSeer HS3

      >Dim fullPath as String = "C:\Program Files\HomeSeer HS3\Logs\Heater_Run_times.txt"

      Comment


      • #4
        Thanks for replies guys. Jim hit it on the head. HS is installed in different directory so the path was incorrect.
        Larry

        Comment

        Working...
        X