bosshunts Posted April 5, 2014 Share Posted April 5, 2014 Hello. Is it possible to have this program click on a certain color at a certain time? Quote Link to comment Share on other sites More sharing options...
Wanted Posted April 7, 2014 Share Posted April 7, 2014 Yes FindColor Mouse Wait conditional operators etc. Quote Link to comment Share on other sites More sharing options...
bosshunts Posted April 7, 2014 Author Share Posted April 7, 2014 Yes FindColor Mouse Wait conditional operators etc. Can I get an example please? ^^ Quote Link to comment Share on other sites More sharing options...
slacky Posted April 7, 2014 Share Posted April 7, 2014 (edited) Can I get an example please? ^^ You have to elaborate a bit further for me to be able to help you. Do you mean at 3pm do something.. or do you mean 10 sec after another thing has been done, do something? There are several functions used to find the pos of a color: » FindColorTol(out x,y:Integer; color, x1,y1,x2,y2, tolerance: Integer); » FindColorSpiralTol(CenterX,CenterY:Integer; var x,y:Integer; Color, x1,y1,x2,y2, tolerance:Integer); x and y is the resulting postion of wherer the color was FIRST found: var Pt: TPoint; //TPoint holds and X, and an Y coordinate. So it can always be used instead of: "var x,y: Integer". begin FindColorTol(Pt.x, Pt.y, 255, 0,0,500,500, 10); WriteLn(PointToStr(Pt)); // Found color 255 (red) at that location end; and then we have more advanced versions, which puts ALL the found results in to an array: » FindColorTolEx(var TPA:TPointArray; color, x1,y1,x2,y2, tolerance: Integer); The TPA is an array of all the points found of the given color. This can be manipulated to find groups/clusters where the color is close to each other, and thereby eliminate noise, and allow for even more checks to ensure we are getting the right group, and in the end we often just click the center of that group. EG: var W,H, i: Integer; TPA:TPointArray; Groups: T2DPointArray; begin // find all black-ish colors in the area 0,0, to 500,500 FindColorTolEx(TPA, 1, 0,0,500,500, 10); // create groups where colors are close to each other // 6 is the max distance between points in that group. Groups := SplitTPA(TPA, 6); // go though each group and check if it's the correct size for i:=0 to High(Groups) do begin // get the group width and height TPADimensions(Groups[i], W,H); if ((W > 5) and (W < 100)) and ((H > 8) and (H < 20)) then // it passes, we print the middle of that group: TPACenter(Groups[i]) WriteLn(PointToStr( TPACenter(Groups[i]) )); end; end. To help more I need you to elaborate further. Edited April 7, 2014 by slacky Quote Link to comment Share on other sites More sharing options...
bosshunts Posted April 7, 2014 Author Share Posted April 7, 2014 You have to elaborate a bit further for me to be able to help you. Do you mean at 3pm do something.. or do you mean 10 sec after another thing has been done, do something? There are several functions used to find the pos of a color: » FindColorTol(out x,y:Integer; color, x1,y1,x2,y2, tolerance: Integer); » FindColorSpiralTol(CenterX,CenterY:Integer; var x,y:Integer; Color, x1,y1,x2,y2, tolerance:Integer); x and y is the resulting postion of wherer the color was FIRST found: var Pt: TPoint; //TPoint holds and X, and an Y coordinate. So it can always be used instead of: "var x,y: Integer". begin FindColorTol(Pt.x, Pt.y, 255, 0,0,500,500, 10); WriteLn(PointToStr(Pt)); // Found color 255 (red) at that location end; and then we have more advanced versions, which puts ALL the found results in to an array: » FindColorTolEx(var TPA:TPointArray; color, x1,y1,x2,y2, tolerance: Integer); The TPA is an array of all the points found of the given color. This can be manipulated to find groups/clusters where the color is close to each other, and thereby eliminate noise, and allow for even more checks to ensure we are getting the right group, and in the end we often just click the center of that group. EG: var W,H, i: Integer; TPA:TPointArray; Groups: T2DPointArray; begin // find all black-ish colors in the area 0,0, to 500,500 FindColorTolEx(TPA, 1, 0,0,500,500, 10); // create groups where colors are close to each other // 6 is the max distance between points in that group. Groups := SplitTPA(TPA, 6); // go though each group and check if it's the correct size for i:=0 to High(Groups) do begin // get the group width and height TPADimensions(Groups[i], W,H); if ((W > 5) and (W < 100)) and ((H > 8) and (H < 20)) then // it passes, we print the middle of that group: TPACenter(Groups[i]) WriteLn(PointToStr( TPACenter(Groups[i]) )); end; end. To help more I need you to elaborate further. This method is obviously a little too advanced for me. I can work without it. Thanks anyway though. Quote Link to comment Share on other sites More sharing options...