UnknownWarrior Posted November 27, 2006 Posted November 27, 2006 Alright i have this one program im trying to make but what i do is search for the red color (i got that) but the button i want it to click is a few coordinates down, i know how to do mouse move of course but that wont help because the red color could appear at any where on the screen so i need it to find the red color and go down a few coordinates (just straight down) Thanks for any help you are willing to give
mikehunt114 Posted November 27, 2006 Posted November 27, 2006 (edited) For future reference, you should include any code you have applied to this situation so far, saves people from writing out the entire thing. It's always a good idea to give as much information as possible, I'm at fault for being vague sometimes too, just keep in mind that the less work someone has to do to help you, the more likely they are to help. $color = ;The color you are searching for While 1 $colorpos = PixelSearch(0+5, 0+5, @DesktopWidth-5, @DesktopHeight-5, $color, 10, 1 If IsArray($colorpos) Then $drop = ;How many pixels down you want to go $buttonposx = $pos[0] - $drop $buttonposy = $pos[1] MouseClick("Left", $buttonposx , $buttonposy, 1, 0) EndIf WEnd Hopefully that helps. Edited November 27, 2006 by mikehunt114 IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
UnknownWarrior Posted November 27, 2006 Author Posted November 27, 2006 (edited) For future reference, you should include any code you have applied to this situation so far, saves people from writing out the entire thing. It's always a good idea to give as much information as possible, I'm at fault for being vague sometimes too, just keep in mind that the less work someone has to do to help you, the more likely they are to help. $color = ;The color you are searching for While 1 $colorpos = PixelSearch(0+5, 0+5, @DesktopWidth-5, @DesktopHeight-5, $color, 10, 1 If IsArray($colorpos) Then $drop = ;How many pixels down you want to go $buttonposx = $pos[0] - $drop $buttonposy = $pos[1] MouseClick("Left", $buttonposx , $buttonposy, 1, 0) EndIf WEnd Hopefully that helps. thank you, just one more question, well 2 actually 1. with the mouseclick can i change it ro right without changing anything else? 2. and with the $drop function, what you mean how many pixels down? well i know what you mean but how can i tell how many pixels to go down or not? EDIT: Tested it out with guessing and well problems occur and since im havent studied this far yet no clue what to do $color = 0xB50400 While 1 $colorpos = PixelSearch(0+5, 0+5, @DesktopWidth-5, @DesktopHeight-5, $color, 10, 1) If IsArray($colorpos) Then $drop = 20 $buttonposx = $pos[0] - $drop ;Says right here variable hasnt been declared and im guessing if that one hasnt the next one wont either $buttonposy = $pos[1] MouseClick("Right", $buttonposx , $buttonposy, 1, 0) EndIf WEnd Edited November 27, 2006 by UnknownWarrior
mikehunt114 Posted November 28, 2006 Posted November 28, 2006 (edited) My bad, typos there. Should be:$color = ;The color you are searching for While 1 $colorpos = PixelSearch(0+5, 0+5, @DesktopWidth-5, @DesktopHeight-5, $color, 10, 1) If IsArray($colorpos) Then $drop = ;How many pixels down you want to go $buttonposx = $colorpos[0] - $drop $buttonposy = $colorpos[1] MouseClick("Left", $buttonposx , $buttonposy, 1, 0) EndIf WEndYes you can just change the MouseClick to "right", look that function up in the helpfile. You can use AU3Info to get the difference in pixels hopefully.Edit: Forgot a bracket. Edited November 28, 2006 by mikehunt114 IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
UnknownWarrior Posted November 28, 2006 Author Posted November 28, 2006 My bad, typos there. Should be: $color = ;The color you are searching for While 1 $colorpos = PixelSearch(0+5, 0+5, @DesktopWidth-5, @DesktopHeight-5, $color, 10, 1 If IsArray($colorpos) Then $drop = ;How many pixels down you want to go $buttonposx = $colorpos[0] - $drop $buttonposy = $colorpos[1] MouseClick("Left", $buttonposx , $buttonposy, 1, 0) EndIf WEnd Yes you can just change the MouseClick to "right", look that function up in the helpfile. You can use AU3Info to get the difference in pixels hopefully. Hmm seems to not work, when i put in like 30 pixels instead of going straight down from the red it finds it goes straight left... any ideas?
mikehunt114 Posted November 28, 2006 Posted November 28, 2006 (edited) Sorry, my mistake again, the $drop should come into play with the y coordinates like so: $color = ;The color you are searching for While 1 $colorpos = PixelSearch(0+5, 0+5, @DesktopWidth-5, @DesktopHeight-5, $color, 10, 1) If IsArray($colorpos) Then $drop = ;How many pixels down you want to go $buttonposx = $colorpos[0] $buttonposy = $colorpos[1] - $drop MouseClick("Left", $buttonposx , $buttonposy, 1, 0) EndIf WEnd Edited November 28, 2006 by mikehunt114 IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
UnknownWarrior Posted November 28, 2006 Author Posted November 28, 2006 I hate to keep asking questions but now the problem is it goes above the red bar not below it :s
mikehunt114 Posted November 29, 2006 Posted November 29, 2006 Try: $buttonposy = $colorpos[1] + $drop then. These questions are getting pretty straightforward, are you not understanding what's goin on with this code? IE Dev ToolbarMSDN: InternetExplorer ObjectMSDN: HTML/DHTML Reference Guide[quote]It is surprising what a man can do when he has to, and how little most men will do when they don't have to. - Walter Linn[/quote]--------------------[font="Franklin Gothic Medium"]Post a reproducer with less than 100 lines of code.[/font]
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