JuanLopez Posted March 17, 2018 Share Posted March 17, 2018 Cant Figure Out If This Is Possible, Stop script if Mouse Match/Exceeds Y coordinates I have a script that moves slowly to the right horizantly after a given action is performed and if the mouse coordinates reaches the Y coordinates or passes it I would like the script to stop Ive been searching but not sure if its not possible or im not thinking outside the box enough or if I just havent hit the right keywords to find the info to help me solve this so here helping for some help to point me in the right direction. Some info you might need to know to help me some more, the action is taking place inside a chrome browser the Y coordinates is the edge of the browser (or 20 pixels before doesnt matter here) Link to comment Share on other sites More sharing options...
Developers Jos Posted March 17, 2018 Developers Share Posted March 17, 2018 6 minutes ago, JuanLopez said: Some info you might need to know to help me some more, Yeap... the current script would show what you are doing. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
JuanLopez Posted March 17, 2018 Author Share Posted March 17, 2018 (edited) 2 hours ago, Jos said: Yeap... the current script would show what you are doing. Jos $a = MouseGetPos() MouseClick($MOUSE_CLICK_RIGHT, $a[0] , $a[1], 1) Sleep(4000) MouseClick($MOUSE_CLICK_LEFT, $a[0] + 20, $a[1] +20, 1) Sleep(4000) MouseMove($a[0] , $a[1], 0) Sleep(4000) MouseMove($a[0] +80 , $a[1], 0) Im getting the mouse coordinates from where I want to start (where I leave the mouse) and It does an action and moves right x amount and repeats and what Im trying to implement next is when it hits end of the page to stop which I cant figure out how to even attack that. Edited March 17, 2018 by JuanLopez Link to comment Share on other sites More sharing options...
jplumb Posted March 17, 2018 Share Posted March 17, 2018 Try this: Local $mousePos = MouseGetPos() Local $maxX = REPLACE_WITH_MAX_X_VALUE For $x = $mousePos[0] To $maxX Step 80 MouseClick($MOUSE_CLICK_RIGHT, $x, $mousePos[1], 1) Sleep(4000) MouseClick($MOUSE_CLICK_LEFT, $x + 20, $mousePos[1] + 20, 1) Sleep(4000) Next And, if you don't know where the max X will be (because maybe your window might move), you can use: ; WinGetPos returns a 4x array, where ; [0] = the X of the upper-left corner of the window ; [1] = the Y of the upper-left corner of the window ; [2] = the width of the window ; [3] = the height of the window Local $windowRect = WinGetPos("INSERT_TITLE_OF_WINDOW_HERE") Local $maxX = $windowRect[0] + $windowRect[2] JuanLopez 1 Link to comment Share on other sites More sharing options...
JuanLopez Posted March 17, 2018 Author Share Posted March 17, 2018 16 minutes ago, jplumb said: Try this: Local $mousePos = MouseGetPos() Local $maxX = REPLACE_WITH_MAX_X_VALUE For $x = $mousePos[0] To $maxX Step 80 MouseClick($MOUSE_CLICK_RIGHT, $x, $mousePos[1], 1) Sleep(4000) MouseClick($MOUSE_CLICK_LEFT, $x + 20, $mousePos[1] + 20, 1) Sleep(4000) Next And, if you don't know where the max X will be (because maybe your window might move), you can use: ; WinGetPos returns a 4x array, where ; [0] = the X of the upper-left corner of the window ; [1] = the Y of the upper-left corner of the window ; [2] = the width of the window ; [3] = the height of the window Local $windowRect = WinGetPos("INSERT_TITLE_OF_WINDOW_HERE") Local $maxX = $windowRect[0] + $windowRect[2] Thanks that worked perfectly, and easy to understand, big props I appreciate your help. 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