Jump to content

Mouse movement inside a specific window


Recommended Posts

Hi 

I use the method below to make a click inside a specific window called "TEST" on a "activate" button

        WinActivate("TEST")
        ControlClick("TEST", "", "", "left", 1, 109, 170)

 

How to I make a mouse slide movement inside the same window to example move a slider to a specific position?

MouseClickDrag ( "button", x1, y1, x2, y2) Does not seem to work because the x and y positions are relative to the PC screen and not the window coordinates
The window is not always in same position on the screen, also ControlClick leaves my mouse free to use while the script run
 

Link to comment
Share on other sites

#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

HotKeySet("{END}", "_Test1") ; <----------  {END}

TestGUI()

Func TestGUI()

    GUICreate("TEST", 220, 100, 100, 200)
    GUISetBkColor(0x00E0FFFF) ; will change background color

    Local $idSlider1 = GUICtrlCreateSlider(10, 10, 200, 20)
    GUICtrlSetLimit(-1, 200, 0) ; change min/max value
    Local $idButton = GUICtrlCreateButton("Value?", 75, 70, 70, 20)
    GUISetState(@SW_SHOW)
    GUICtrlSetData($idSlider1, 40) ; set cursor

    Local $idMsg
    ; Loop until the user exits.
    While 1
        $idMsg = GUIGetMsg()
        Switch $idMsg
            Case $GUI_EVENT_CLOSE
                ExitLoop

            Case $idButton
                ConsoleWrite("- slider1=" & GUICtrlRead($idSlider1) & @CRLF)

        EndSwitch
    WEnd

EndFunc   ;==>TestGUI
;----------------------------------------------------------------------------------------
Func _Test1()
    Local $hWnd = WinWait("TEST")
    WinActivate($hWnd)

    ControlClick($hWnd, "", "msctls_trackbar321", "left", 1, 10, 7)
    ControlClick($hWnd, "", "Button1")

EndFunc   ;==>_Test1
;----------------------------------------------------------------------------------------

 

I know that I know nothing

Link to comment
Share on other sites

1 minute ago, ioa747 said:
#include <GUIConstantsEx.au3>
#include <MsgBoxConstants.au3>

HotKeySet("{END}", "_Test1") ; <----------  {END}

TestGUI()

Func TestGUI()

    GUICreate("TEST", 220, 100, 100, 200)
    GUISetBkColor(0x00E0FFFF) ; will change background color

    Local $idSlider1 = GUICtrlCreateSlider(10, 10, 200, 20)
    GUICtrlSetLimit(-1, 200, 0) ; change min/max value
    Local $idButton = GUICtrlCreateButton("Value?", 75, 70, 70, 20)
    GUISetState(@SW_SHOW)
    GUICtrlSetData($idSlider1, 40) ; set cursor

    Local $idMsg
    ; Loop until the user exits.
    While 1
        $idMsg = GUIGetMsg()
        Switch $idMsg
            Case $GUI_EVENT_CLOSE
                ExitLoop

            Case $idButton
                ConsoleWrite("- slider1=" & GUICtrlRead($idSlider1) & @CRLF)

        EndSwitch
    WEnd

EndFunc   ;==>TestGUI
;----------------------------------------------------------------------------------------
Func _Test1()
    Local $hWnd = WinWait("TEST")
    WinActivate($hWnd)

    ControlClick($hWnd, "", "msctls_trackbar321", "left", 1, 10, 7)
    ControlClick($hWnd, "", "Button1")

EndFunc   ;==>_Test1
;----------------------------------------------------------------------------------------

 

Thank you :)

 

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...