No announcement yet.

HS2 and Windows 10: vb Compiling Script Error

  • Filter
  • Time
  • Show
Clear All
new posts

  • HS2 and Windows 10: vb Compiling Script Error

    So is HS2 still something we can talk about? For the purpose of this question, I have to assume it is.

    I haven't upgraded to HS3 because of several scripts that will first need to be rewritten. However, I am trying to upgrade to Windows 10.

    I reinstalled HS2 and then pasted all the files back on top within the new directory. It 'seems everything' is working except for one thing:

    When I try to compile or test a .vb script, I've written, as an 'event', I get this error in my log: "Compiling script code: Exception has been thrown by the target of an invocation." It always worked fine in Windows 7 and it still works and runs fine in tenScripting in w10.

    Does anyone have a quick hint or an elaborate solution? Thank you!


  • #2
    You will need to post the script for us to assist.


    • #3
      Thanks Rupp!

      The script is around 3,200 lines of sloppy code. I would hate to dump that on anyone.

      But I believe you are indicating that there is probably some code within the script that something in Windows 10 doesn't like, but that windows 7 could deal with. And that an HS2 .vb script should work in Windows 10.

      If that is what you are thinking, I can reduce the code down to find the offending lines. Have you heard of a similar situation?

      Thank you Rupp.



      • #4
        Windows 10 provides compatibility modes. Have you tried running HS2 in XP compatibility mode?

        Sent from my iPad using Tapatalk
        HomeSeer Version: HS3 Pro Edition, Operating System: Microsoft Windows 10 - Home, Number of Devices: 373, Number of Events: 666, Enabled Plug-Ins BLRF, BLUSBUIRT, HSTouch Server, mcsXap, NetCAM, X10, Z-Wave,Alexa,HomeKit


        • #5
          Yes Steve, I did try XP, service pack 2 & 3.

          The problem might be related to permissions. The vb script has to access Homeseer, three URLs on the Internet, two URLs on my home network, and send an email.

          When I initially attempt to run the script under tenScripting in Visual Basic 2010 Express, a prompt comes on asking whether I want to "restart the application with elevated permissions." When I do that, the script runs in that test bed.

          Perhaps that is a hint. Windows 10 seems to handle permissions differently than Windows 7. I plan to rewrite the script with stuff REM'd out.

          Thanks for your support.



          • #6
            Originally posted by Rupp View Post
            You will need to post the script for us to assist.
            I've determined the only problem is "MySqlConnection". HS2 in Windows 10 gives this error when it tries to compile:

            "Error - Compiling script code: Exception has been thrown by the target of an invocation."

            If I REM out the line that includes 'MySqlConnection', the script compiles but does not have mySql access.
            PHP Code:
            Imports MySql.Data.MySqlClient

                Dim myConnString 
            As String "server=[server];user id=[id];password=[pw];database=[db]"
            Dim mySQLconn As New MySqlConnection(myConnString)
            Dim sMsgSrc As String

            Public Sub Main(ByVal Parm As Object)

            hs.WriteLog(sMsgSrc"Begin  Calculations")
            hs.WriteLog(sMsgSrc"End Calculations")
            End Sub 
            Is there a way around this issue?

            The script compiles fine in tenScripting running on the same PC.

            Thank you.
            Last edited by frankc; March 15th, 2016, 12:02 PM.


            • #7

              Turned out to be Permissions issue in Windows 10. In order to fix it:

              In File Manager, Right click on HomeSeer.exe
              Left click on "Troubleshoot compatibility"
              Then "Troubleshoot Program"
              Then check the box next to "The program requires additional permissions"
              click: Next
              Then: Save Settings.

              I also did this on the .exe for Visual Basic 2010 Express. Doing so allows tenScripting to run without restarting Visual Basic to obtain "elevated permissions".