Announcement

Collapse
No announcement yet.

Namespace or type specified in the Imports 'System.Core' error

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

  • Namespace or type specified in the Imports 'System.Core' error

    Dear all,

    I having taken my first steps in scripting, but experience a problem which i cannot seem to solve. When I run the script in 'tenScripting3', it runs and does what it has to do. But when included in an event, I get:

    Compiling script C:\Program Files (x86)\HomeSeer HS3\scripts\ArduinoGas.vb: Namespace or type specified in the Imports 'System.Core' doesn't contain any public member or cannot be found. Make sure the namespace or the type is defined and contains at least one public member. Make sure the imported element name doesn't use any aliases.

    Script:

    Imports Microsoft.VisualBasic
    Public Sub Main(ByVal Parms As Object)
    Dim prvValue As Double '' Previous value saved at midnight
    Dim actValue As Double '' Actual value
    Dim dayValue As Double '' Day value
    '' Read previous value stored at midnight
    prvValue = hs.DeviceValueEx(928)
    '' Read actual value
    actValue = hs.DeviceValueEx(731)
    '' Calculate day consumption
    dayValue = actValue - prvValue
    hs.SetDeviceValueByRef(929, dayValue, True)
    End Sub



  • #2
    Remove the first line - its not needed in this case.

    Comment


    • #3
      You are right. I did not include that line myself, the tenScripting3 software did, and I missed it when using the script in the event.
      Now it works.

      Comment


      • #4
        Originally posted by backkri View Post
        You are right. I did not include that line myself, the tenScripting3 software did, and I missed it when using the script in the event.
        Now it works.
        tenScripting should only have added that line if it exists somewhere in your script file. All Imports within the file are added to all exported scripts. If not the case, I'd like to look at it to see what it happening.

        tenholde
        tenholde

        Comment


        • #5
          Sorry for the false accusation towards tenscripting (which was very useful to debug the script). Did the final tests late last night, must have been partially blind somehow. Missed the first line in my code, I guess I must have copied it from somewhere, but no idea where it came from.

          Kristof.

          Comment

          Working...
          X