Jump to content

mouse position


usera
 Share

Recommended Posts

Greeting,

I had one application, open a windows, a button in the windows, I need use script to click on the button.

the question is the window could be open in any area of the desktop, and the desktop screen size maybe different.

how can I make sure I always click on that button use "Logical Position" of the application window, instead of "Physical position" of the desktop.

Thanks

usera

Link to comment
Share on other sites

You mean that the button is always on the same coordinates in the window itself?

If so, take a look at the Control functions.

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

Link to comment
Share on other sites

You mean that the button is always on the same coordinates in the window itself?

If so, take a look at the Control functions.

thanks,

Yes,

tried control, but do not fully understand,

is that possible can provide some sample? the help is not that good

Link to comment
Share on other sites

Take a look at the functions WinGetTitle, ControlClick.

Heres a little sample:

HotKeySet("{F10}", "DoScript")

Global $hWnd = GUICreate("SoftwareTitleHere")
Global $hButton = GUICtrlCreateButton("Click me!", Random(10, 200, 1), Random(10, 350, 1), 200, 30)

GUISetState()
While 1
    Switch GUIGetMsg()
        Case -3
            Exit

        Case $hButton
            MsgBox(0, "", "Button clicked!")

    EndSwitch
WEnd

Func DoScript()
    $sTitle = WinGetTitle("Software")

    ControlClick($sTitle, "", "[CLASS:Button;INSTANCE:1]", "left", 1)
EndFunc

You can retreive the classname + instance number using the Au3Info.exe (C:Program Files (x86)AutoIt3).

Minesweeper

A minesweeper game created in autoit, source available.

_Mouse_UDF

An UDF for registering functions to mouse events, made in pure autoit.

2D Hitbox Editor

A 2D hitbox editor for quick creation of 2D sphere and rectangle hitboxes.

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