Sign in to follow this  
Followers 0
epicfail

mouse click all Screen Resolution

7 posts in this topic

how doi set the mouse click on all Screen Resolutions?

Share this post


Link to post
Share on other sites



Maybe just convert it to a percentage across the screen?

Like this:

#Include <Misc.au3>

ToolTip( "Waiting for you to click the mouse to set initial position", @DesktopWidth / 2, 50, "Awaiting input.", 1, 2 )
;Set mouse click position
While 1
    If _IsPressed( 01 ) Then
        $MP = MouseGetPos()
        $RelativePOSX = $MP[0] / @DesktopWidth
        $RelativePOSY = $MP[1] / @DesktopHeight
        ToolTip("")
        ExitLoop
    EndIf
    Sleep(10)
WEnd
MsgBox( 0, "TEST Relative mouse click", $RelativePOSX * 100 & "% of desktop width." & @CRLF & $RelativePOSY * 100 & "% of desktop Height." )

Share this post


Link to post
Share on other sites

yeah but i want it to click in the same spot of a window no matter the res size

Share this post


Link to post
Share on other sites

It would be almost the same thing.

You would want to change the mouse coordinate mode to the active window though, and take the app windows height and width for comparison instead of the desktop.

like this:

#Include <Misc.au3>
Opt( 'MouseCoordMode', 0 )
ToolTip( "Waiting for you to click the mouse to set initial position", @DesktopWidth / 2, 50, "Awaiting input.", 1, 2 )
;Set mouse click position
While 1
    If _IsPressed( 01 ) Then
        $MP = MouseGetPos()
        $size = WinGetPos("[active]")
        $app = WinGetTitle("[active]")
        $RelativePOSX = $MP[0] / $size[2]
        $RelativePOSY = $MP[1] / $size[3]
        ToolTip("")
        ExitLoop
    EndIf
    Sleep(10)
WEnd
MsgBox( 0, "TEST Relative mouse click", $RelativePOSX * 100 & "% of " & $app & " width." & @CRLF & $RelativePOSY * 100 & "% of " & $app & " Height." )

Share this post


Link to post
Share on other sites

In an effort to give a better example, I have included the code used to click the mouse on the saved relative coordinates:

#include <Misc.au3>
Opt('MouseCoordMode', 0)
ToolTip("Waiting for you to click the mouse to set initial position", @DesktopWidth / 2, 50, "Awaiting input.", 1, 2)
;Set mouse click position
While 1
    If _IsPressed(01) Then
        $MP = MouseGetPos()
        $size = WinGetPos("[active]")
        $app = WinGetTitle("[active]")
        $RelativePOSX = $MP[0] / $size[2]
        $RelativePOSY = $MP[1] / $size[3]
        ToolTip("")
        ExitLoop
    EndIf
    Sleep(10)
WEnd
MsgBox(0, "TEST Relative mouse click", $RelativePOSX * 100 & "% of " & $app & " width." & @CRLF & $RelativePOSY * 100 & "% of " & $app & " Height." )

$sizeApp = WinGetPos($app)

MsgBox(0, "Example", "Using Opt('MouseCoordMode', 0) still" )
WinActivate( $app )
MouseClick( "Left", $sizeApp[2] * $RelativePOSX, $sizeApp[3] * $RelativePOSY)

MsgBox(0, "Example", "Using Opt('MouseCoordMode', 1)" )
Opt( 'MouseCoordMode', 1)
WinActivate($app)
MouseClick( "Left", $sizeApp[0] + ($sizeApp[2] * $RelativePOSX), $sizeApp[1] + ($sizeApp[3] * $RelativePOSY) )

Share this post


Link to post
Share on other sites

thanks but how do i change where it clicks and is there a easier way to record where u click then it converts it 4 me?

Share this post


Link to post
Share on other sites

cos i want to be able to make a bot 4 a online game so it can be used on heaps of computers

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