epicfail Posted September 4, 2009 Share Posted September 4, 2009 how doi set the mouse click on all Screen Resolutions? Link to comment Share on other sites More sharing options...
DW1 Posted September 4, 2009 Share Posted September 4, 2009 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." ) AutoIt3 Online Help Link to comment Share on other sites More sharing options...
epicfail Posted September 4, 2009 Author Share Posted September 4, 2009 yeah but i want it to click in the same spot of a window no matter the res size Link to comment Share on other sites More sharing options...
DW1 Posted September 4, 2009 Share Posted September 4, 2009 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." ) AutoIt3 Online Help Link to comment Share on other sites More sharing options...
DW1 Posted September 4, 2009 Share Posted September 4, 2009 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) ) AutoIt3 Online Help Link to comment Share on other sites More sharing options...
epicfail Posted September 6, 2009 Author Share Posted September 6, 2009 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? Link to comment Share on other sites More sharing options...
epicfail Posted September 6, 2009 Author Share Posted September 6, 2009 cos i want to be able to make a bot 4 a online game so it can be used on heaps of computers Link to comment Share on other sites More sharing options...
Recommended Posts
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 accountSign in
Already have an account? Sign in here.
Sign In Now