Sign in to follow this  
Followers 0
usera

mouse position

6 posts in this topic

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

Share this post


Link to post
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.

Share this post


Link to post
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

Share this post


Link to post
Share on other sites

#4 ·  Posted (edited)

the help is not that good

BLASPHEMY!!!

In particular, ControlGetPos.

Edited by JohnQSmith

Whenever someone says "pls" because it's shorter than "please", I say "no" because it's shorter than "yes".

Share this post


Link to post
Share on other sites

BLASPHEMY!!!

In particular, ControlGetPos.

sorry I just want to say help is not good for me to understand because i am new here. the Help itself is good!

Share this post


Link to post
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.

Share this post


Link to post
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
Sign in to follow this  
Followers 0