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 25, 2018, 02:02 PM.
    Mike____________________________________________________________ __________________
    HS3 Pro Edition 3.0.0.548, NUC i3

    HW: Stargate | NX8e | CAV6.6 | Squeezebox | PCS | WGL 800RF | RFXCOM | Vantage Pro | Green-Eye | Edgeport/8 | Way2Call | Ecobee3 | EtherRain | Ubiquiti

    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