Announcement

Collapse
No announcement yet.

Multiple errors. Compiler not working on W7 64bit?

Collapse
This topic is closed.
X
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    Multiple errors. Compiler not working on W7 64bit?

    This is the code I want to run. This works perfectly in my standalone (.NET 2.0) program:

    Code:
    '#IMPORT System.Runtime.InteropServices
    
    '<DllImport("user32.dll")> _
    Private Declare Sub mouse_event Lib "user32.dll" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal dwData As Long, ByVal dwExtraInfo As IntPtr)
    
    Sub Main(ByVal param As Object)
        Dim params() As String = param.ToString().Split("|")
        GenerateMouseClick(params(0), params(1), params(2))
    
    End Sub
    
    Private Sub GenerateMouseClick(ByVal x As Integer, ByVal y As Integer, Optional ByVal mouseclicks As Integer = 2, Optional ByVal return_mouse As Boolean = True)
        Try
            If mouseclicks < 1 OrElse mouseclicks > 3 Then
                hs.Writeline("MouseClick", "Only 1, 2 or 3 mouse clicks are allowed")
                Exit Sub
            End If
    
            Dim pointOldPosition As Point = Windows.Forms.Cursor.Position
            Windows.Forms.Cursor.Position = New Point(x, y)
    
            For i As Integer = 1 To mouseclicks
                mouse_event(MouseEventLeftDown, 0, 0, 0, New System.IntPtr())
                mouse_event(MouseEventLeftUp, 0, 0, 0, New System.IntPtr())
            Next
    
            If return_mouse Then Windows.Forms.Cursor.Position = pointOldPosition
        Catch ex As Exception
            hs.Writeline("MouseClick", "Error occured. Sorry about that..." & ControlChars.NewLine & ControlChars.NewLine & ex.ToString)
        End Try
    End Sub

    I get these errors in the debugging window:
    09:47:01 Executing script: remote_mouseclick.vb
    09:47:01 Compile Error : Scripts\remote_mouseclick.vb : CompilerError[s] :
    line:15 error:BC30456 ''Writeline' is not a member of 'Scheduler.hsapplication'.'
    line:19 error:BC30002 'Type 'Point' is not defined.'
    line:20 error:BC30451 'Name 'Windows' is not declared.'
    line:20 error:BC30002 'Type 'Point' is not defined.'
    line:23 error:BC30451 'Name 'MouseEventLeftDown' is not declared.'
    line:24 error:BC30451 'Name 'MouseEventLeftUp' is not declared.'
    line:27 error:BC30451 'Name 'Windows' is not declared.'
    line:29 error:BC30456 ''Writeline' is not a member of 'Scheduler.hsapplication'.'
    line:29 error:BC30451 'Name 'ControlChars' is not declared.'
    line:29 error:BC30451 'Name 'ControlChars' is not declared.'
    All the types are missing. And what is going on with "Writeline"?



    EDIT: I must be doing something wrong. But what?!?
    The sample scripts works...
    HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
    Running on Windows 10 (64) virtualized
    on ESXi (Fujitsu Primergy TX150 S8).
    WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

    Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

    #2
    Try to add a #IMPORT at the top for system.drawing.dll

    #IMPORT System.Drawing,system.drawing.dll

    For the Writeline error, check the casing. I think it's WriteLine
    --
    stipus

    Comment


      #3
      Thanks, it was a capital L missing in WriteLine.



      BUT; I'm having problems with this line:
      #IMPORT System.Runtime.InteropServices

      which gives the error:
      1:39:00 Compile Error : Scripts\remote_mouseclick.vb : Error in #IMPORT Namespace,Dll Statement


      But System.Runtime.InteropServices is (according to my google search) a part of mscorelib.dll and shouldn't need to be referenced.

      When I try it, I get this:
      11:40:03 Compile Error : Scripts\remote_mouseclick.vb : CompilerError[s] :
      line:-26 error:BC2017 'could not find library 'mscorelib.dll''
      line:-26 error:BC2000 'compiler initialization failed unexpectedly: 0x80070002'
      HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
      Running on Windows 10 (64) virtualized
      on ESXi (Fujitsu Primergy TX150 S8).
      WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

      Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

      Comment


        #4
        This works:

        Code:
        #IMPORT System.Drawing,system.drawing.dll
        #IMPORT System.Windows.Forms,system.windows.forms.dll
        
        Private Declare Sub mouse_event Lib "user32.dll" (ByVal dwFlags As Long, ByVal dx As Long, ByVal dy As Long, ByVal dwData As Long, ByVal dwExtraInfo As IntPtr)
        
        Private Const MouseEventLeftDown As Int32 = 2
        Private Const MouseEventLeftUp As Int32 = 4
        
        
        Public Sub Main(ByVal param As Object)
            Dim params() As String = param.ToString().Split("|")
            If params.Length > 2 Then GenerateMouseClick(params(0), params(1), params(2))
        
        End Sub
        
        Private Sub GenerateMouseClick(ByVal x As Integer, ByVal y As Integer, Optional ByVal mouseclicks As Integer = 2, Optional ByVal return_mouse As Boolean = True)
            Try
                If mouseclicks < 1 OrElse mouseclicks > 3 Then
                    hs.WriteLine("MouseClick", "Only 1, 2 or 3 mouse clicks are allowed")
                    Exit Sub
                End If
        
                Dim pointOldPosition As Point = Windows.Forms.Cursor.Position
                Windows.Forms.Cursor.Position = New Point(x, y)
        
                For i As Integer = 1 To mouseclicks
                    mouse_event(MouseEventLeftDown, 0, 0, 0, New System.IntPtr())
                    mouse_event(MouseEventLeftUp, 0, 0, 0, New System.IntPtr())
                Next
        
                If return_mouse Then Windows.Forms.Cursor.Position = pointOldPosition
            Catch ex As Exception
                hs.WriteLine("MouseClick", "Error occured. Sorry about that...")
            End Try
        End Sub

        BUT: If I don't comment out the WriteLine lines, I still get get these errors:
        12:04:28 Compile Error : Scripts\remote_mouseclick.vb : CompilerError[s] :
        line:19 error:BC30456 ''WriteLine' is not a member of 'Scheduler.hsapplication'.'
        line:33 error:BC30456 ''WriteLine' is not a member of 'Scheduler.hsapplication'.'




        EDIT: And that is because I'm an idiot! It's not WriteLine, it's WriteLOG!
        HSPro 3.0.0.458, Z-NET with Z-wave plugin 3.0.1.190, RFXCOM + 2x RFXtrx433E, HSTouch, Squeezebox plugin, iTach IP/WF2IR & GC-100-6 with UltraGCIR, BLDenon, NetcamStudio, Jon00s Webpage builder, Harmony Hub plugin, SCSIP (with FreePBX), Arduino plugin, IFTTT, Pushalot plugin, Device History plugin.
        Running on Windows 10 (64) virtualized
        on ESXi (Fujitsu Primergy TX150 S8).
        WinSeer (for Win10) - TextSeer - FitbitSeer - HSPI_MoskusSample

        Are you Norwegian (or Scandinavian) and getting started with HomeSeer? Read the "HomeSeer School"!

        Comment


          #5
          Originally posted by Moskus View Post


          BUT: If I don't comment out the WriteLine lines, I still get get these errors:
          12:04:28 Compile Error : Scripts\remote_mouseclick.vb : CompilerError[s] :
          line:19 error:BC30456 ''WriteLine' is not a member of 'Scheduler.hsapplication'.'
          line:33 error:BC30456 ''WriteLine' is not a member of 'Scheduler.hsapplication'.'
          Try using hs.Writelog

          EDIT - I see you already discovered that!
          Jon

          Comment

          Working...
          X