h-y-b-r-i-d Posted June 10, 2005 Share Posted June 10, 2005 ok is there a way i can make it click a certain color (0xFF0000) within a certain parameter (rectangle) X:280 Y:293 X:522 Y:293 X:280 Y:694 X:522 Y:694 I need it to watch for 0xFF0000 and click it when ever it pops up, any help? Link to comment Share on other sites More sharing options...
JSThePatriot Posted June 10, 2005 Share Posted June 10, 2005 I dont want to be mean, but did you look in the help file at all? I just clicked the functions and went down to P to look up Pixel and this is what I found.PixelSearchSearches a rectangle of pixels for the pixel color provided.If that normally doesnt work like I cant seem to find the function I use the help file's search ability. Works great. Not to mention the forum has a search.If you have any trouble implementing this in your script then let me know I would be more than happy to assist.Just so you know I am not upset, but it comes with the best helpfile that I have seen come with any program bar none and we take pride in that.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
h-y-b-r-i-d Posted June 10, 2005 Author Share Posted June 10, 2005 sorry i was searching for color Link to comment Share on other sites More sharing options...
JSThePatriot Posted June 10, 2005 Share Posted June 10, 2005 sorry i was searching for color<{POST_SNAPBACK}>Not a problem. I understand that. Let me know if you need help with the actual code. JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
h-y-b-r-i-d Posted June 10, 2005 Author Share Posted June 10, 2005 So far all i have is this lol While WinActive( "D2Trading") PixelSearch( 280, 293, 522, 694, 0xFF0000) but since i want it to loop this the entire time the window is active, so should i set it as a variable? While WinActive( "D2Trading") $click = PixelSearch( 280, 293, 522, 694, 0xFF0000) This is only the second script ive made btw so i kinda suck. Link to comment Share on other sites More sharing options...
JSThePatriot Posted June 10, 2005 Share Posted June 10, 2005 So far all i have is this lolWhile WinActive( "D2Trading") PixelSearch( 280, 293, 522, 694, 0xFF0000) but since i want it to loop this the entire time the window is active, so should i set it as a variable?While WinActive( "D2Trading")$click = PixelSearch( 280, 293, 522, 694, 0xFF0000)This is only the second script ive made btw so i kinda suck.<{POST_SNAPBACK}>Yes you will need a looping statement of some sort.Take a look at the following code. I hope it helps you out some.Dim $coord While WinActive("D2Trading") $coord = PixelSearch(280, 293, 522, 694, 0xFF0000) If Not @error Then ;Do something with the coordinates that it returned. ;$coord[0] = x coordinates. ;$coord[1] = y coordinates. ;I am assuming you want to do a MouseClick on that color... so do this. MouseClick("Left", $coord[0], $coord[1]) ;See how that works? EndIf WEndThat is just some quick and dirty code. Hope it helps you on your way into the ever powerful world of AutoIt.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
h-y-b-r-i-d Posted June 10, 2005 Author Share Posted June 10, 2005 works perfect, any way to speed up how fast it will click tho? Link to comment Share on other sites More sharing options...
JSThePatriot Posted June 11, 2005 Share Posted June 11, 2005 works perfect, any way to speed up how fast it will click tho?<{POST_SNAPBACK}>Couple of ways to speed it up. Make the box smaller and possibly check every other pixel. Let me know if either of those are an option. You know how to make the box smaller. I will show you below what to do if you want to skip pixels.Dim $coord While WinActive("D2Trading") $coord = PixelSearch(280, 293, 522, 694, 0xFF0000, 0, 2);Searches every second pixel If Not @error Then ;Do something with the coordinates that it returned. ;$coord[0] = x coordinates. ;$coord[1] = y coordinates. ;I am assuming you want to do a MouseClick on that color... so do this. MouseClick("Left", $coord[0], $coord[1]) ;See how that works? EndIf WEndI hope the above explains and possibly helps.JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
h-y-b-r-i-d Posted June 11, 2005 Author Share Posted June 11, 2005 works great, i used what u just gave me and made the area smaller so its very fast now, Im going to experiment, and this is what i got to make it more accurate( because the color moves at first) expandcollapse popupWinWaitActive( "D2Trading") Dim $coord While WinActive("D2Trading") $coord = PixelSearch(322, 402, 522, 506, 0xFF0000,) If Not @error Then chooser() ; MouseClick("Left", $coord[0], $coord[1]) ; Sleep(1000) ; EndIf WEnd Func chooser() If $coord[0] > 462 Then elf6() ElseIf $coord[0] > 431 and < 460 Then elf5() ElseIf $coord[0] > 401 And < 421 Then elf4() ElseIf $coord[0] > 377 And < 398 Then elf3() ElseIf $coord[0] > 355 And $coord[1] < 408 Then elf2() ElseIf $coord[0] > 303 < 348 Then elf1() EndFunc Func primary() MouseClick("Left", $coord[0], $coord[1]) Sleep(1000) EndFunc Func elf1() MouseClick("left", 331, 397) EndFunc Func elf2() MouseClick("left", 377, 436) EndFunc Func elf3() MouseClick("left", 389, 458) EndFunc Func elf4() MouseClick("left", 408, 441) EndFunc Func elf5() MouseClick("left", 457, 449) EndFunc Func elf6() MouseClick("left", 437, 427) EndFunc but it always say my else statement has no matching if statement Link to comment Share on other sites More sharing options...
h-y-b-r-i-d Posted June 11, 2005 Author Share Posted June 11, 2005 ok nvm on that i just did this WinWaitActive("D2Trading") Dim $coord While WinActive("D2Trading") PixelSearch(280, 380, 522, 498, 0xFF0000, 0, 2) If Not @error Then click() WEnd Func click() Sleep(500) $coord = PixelSearch(280, 380, 522, 498, 0xFF0000, 0, 2) If Not @error Then MouseClick("Left", $coord[0], $coord[1]) ;See how that works? EndIf EndFunc this way it gives the color half a second to stop moving, ty for your help Link to comment Share on other sites More sharing options...
JSThePatriot Posted June 11, 2005 Share Posted June 11, 2005 As far as above in your Func chooser() you forgot the EndIf before the EndFunc. I hope everything is working good for you. JS AutoIt Links File-String Hash Plugin Updated! 04-02-2008 Plugins have been discontinued. I just found out. ComputerGetInfo UDF's Updated! 11-23-2006 External Links Vortex Revolutions Engineer / Inventor (Web, Desktop, and Mobile Applications, Hardware Gizmos, Consulting, and more) Link to comment Share on other sites More sharing options...
h-y-b-r-i-d Posted June 19, 2005 Author Share Posted June 19, 2005 it finished it so it worked 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