Jump to content

Mouse Clicks


Recommended Posts

Hello my question is pretty brief. When I use AutoIt the mouse is moving so how could I send mouse clicks to a minimized window with actual having to move the mouse so I can I also you use the computer as my script runs. Since, AutoIt takes over the mouse and keyboard to run my script. Thus it is preventing me from doing anything thing else while an installer runs in the background that takes quite some time to install and has numerous dialogs and options prevents me from setting up computer specific settings.

Edited by OmnipotentGeass
Link to comment
Share on other sites

It displays basically nothing but the window title.

>>>> Window <<<<

Title: Installing...

Class: RuntimeContentWindow

Position: 128, 102

Size: 1031, 851

Style: 0x16CF0000

ExStyle: 0x00040100

Handle: 0x00020556

>>>> Control <<<<

Class:

Instance:

ClassnameNN:

Name:

Advanced (Class):

ID:

Text:

Position:

Size:

ControlClick Coords:

Style:

ExStyle:

Handle:

>>>> Mouse <<<<

Position: 633, 412

Cursor ID: 0

Color: 0xC9BF9D

>>>> StatusBar <<<<

>>>> ToolsBar <<<<

>>>> Visible Text <<<<

>>>> Hidden Text <<<<

Edited by OmnipotentGeass
Link to comment
Share on other sites

Sometimes ControlClick just isn't going to work. In these cases I have found that if you have a VM without VMTools installed, the mouse on the VM is independent. This way you can have a virtual machine minimized running whatever script you want. As long as the script is running from inside the VM machine you shouldn't have an issue.

Link to comment
Share on other sites

Sometimes ControlClick just isn't going to work. In these cases I have found that if you have a VM without VMTools installed, the mouse on the VM is independent. This way you can have a virtual machine minimized running whatever script you want. As long as the script is running from inside the VM machine you shouldn't have an issue.

That really doesn't help since I need to both things on the same computer. IS there any win API or something I can use?

Link to comment
Share on other sites

Maybe try this:

;===============================================================================
  ;
  ; Function Name:  _MouseClickPlus()
  ; Version added:  0.1
  ; Description:    Sends a click to window, not entirely accurate, but works 
  ;                 minimized.
  ; Parameter(s):   $Window     =  Title of the window to send click to
  ;                 $Button     =  "left" or "right" mouse button
  ;                 $X          =  X coordinate
  ;                 $Y          =  Y coordinate
  ;                 $Clicks     =  Number of clicks to send
  ; Remarks:        You MUST be in "MouseCoordMode" 0 to use this without bugs.
  ; Author(s):      Insolence <insolence_9@yahoo.com>
  ;
  ;===============================================================================
 Func _MouseClickPlus($Window, $Button = "left", $X = "", $Y = "", $Clicks = 1)
    Local $MK_LBUTTON       =  0x0001
    Local $WM_LBUTTONDOWN   =  0x0201
    Local $WM_LBUTTONUP     =  0x0202
    
    Local $MK_RBUTTON       =  0x0002   
    Local $WM_RBUTTONDOWN   =  0x0204
    Local $WM_RBUTTONUP     =  0x0205
 
    Local $WM_MOUSEMOVE     =  0x0200
    
    Local $i                = 0
    
    Select 
    Case $Button = "left"
       $Button     =  $MK_LBUTTON
       $ButtonDown =  $WM_LBUTTONDOWN
       $ButtonUp   =  $WM_LBUTTONUP
    Case $Button = "right"
       $Button     =  $MK_RBUTTON
       $ButtonDown =  $WM_RBUTTONDOWN
       $ButtonUp   =  $WM_RBUTTONUP
    EndSelect
    
    If $X = "" OR $Y = "" Then
       $MouseCoord = MouseGetPos()
       $X = $MouseCoord[0]
       $Y = $MouseCoord[1]
    EndIf
    
    For $i = 1 to $Clicks
       DllCall("user32.dll", "int", "SendMessage", _
          "hwnd",  WinGetHandle( $Window ), _
          "int",   $WM_MOUSEMOVE, _
          "int",   0, _
          "long",  _MakeLong($X, $Y))
          
       DllCall("user32.dll", "int", "SendMessage", _
          "hwnd",  WinGetHandle( $Window ), _
          "int",   $ButtonDown, _
          "int",   $Button, _
          "long",  _MakeLong($X, $Y))
          
       DllCall("user32.dll", "int", "SendMessage", _
          "hwnd",  WinGetHandle( $Window ), _
          "int",   $ButtonUp, _
          "int",   $Button, _
          "long",  _MakeLong($X, $Y))
    Next
EndFunc

Func _MouseMovePlus($Window, $X = "", $Y = "")
    
        Local $WM_MOUSEMOVE     =  0x0200
        Local $i                = 0
        
    If $X = "" OR $Y = "" Then
       $MouseCoord = MouseGetPos()
       $X = $MouseCoord[0]
       $Y = $MouseCoord[1]
   EndIf

       DllCall("user32.dll", "int", "SendMessage", _
          "hwnd",  WinGetHandle( $Window ), _
          "int",   $WM_MOUSEMOVE, _
          "int",   0, _
          "long",  _MakeLong($X, $Y))
EndFunc

 Func _MakeLong($LoWord,$HiWord)
    Return BitOR($HiWord * 0x10000, BitAND($LoWord, 0xFFFF))
EndFunc
Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...