opiumhautopium1 Posted February 2, 2012 Share Posted February 2, 2012 i got a problem with getcolor it return -1 ?!? var count,col: integer; begin writeln('kontrollpunkt SETANGCORDI') If ANGCordi=true then begin inc(count); writeln('ANGcordi counter'+inttostr(count)); wait (2000); Movemouse(ANGx,ANGy); wait (2000); col := GetColor(ANGx, ANGy); WriteLn('Color at (' + IntToStr(ANGx) + ', ' + IntToStr(ANGy) + ') is ' + IntToStr(col)); terminatescript; end; end; output is kontrollpunkt SETANGCORDI ANGcordi counter1 Color at (122, 170) is -1 Stopped execution (71698 ms) but it is not the color Color Picked: 1320497 at (122, 170) is it a bug or did i something wrong? please help me :-) mfg Quote Link to comment Share on other sites More sharing options...
FHannes Posted February 2, 2012 Share Posted February 2, 2012 It means it can't retrieve the color because the pixel you selected is outside of the client you selected, see: http://msdn.microsoft.com/en-us/library/dd144909%28v=vs.85%29.aspx Quote Link to comment Share on other sites More sharing options...
opiumhautopium1 Posted February 2, 2012 Author Share Posted February 2, 2012 (edited) hmmm it work with begin SetDesktopAsClient; Wait(500); ActivateClient; SetOnTop(GetClientWindowHandle, true); GetClientDimensions(resolution_x, resolution_y); but why my code dont work?? begin if FindWindowTitlePart('seafight.com', true) then WriteLn('seafight.com Seite gefunden') else begin WriteLn('Online Spiele Seite NICHT gefunden'); Terminatescript; end; Wait(500); ActivateClient; SetOnTop(GetClientWindowHandle, true); GetClientDimensions(resolution_x, resolution_y); OUTPUT: Successfully compiled (125 ms) seafight.com Seite gefunden Seafightseite: 1775x 1556 MMmap found at 1324 / 619 ... ... the coordinate is inside the seafight page the mouse move on the right point(ANGx,ANGy) but if i setdesktopasclient my script do some things outside the seafightpage......... bad sorry that i waste your time and thanks for answer me Edited February 2, 2012 by opiumhautopium1 Quote Link to comment Share on other sites More sharing options...
FHannes Posted February 2, 2012 Share Posted February 2, 2012 Well, that's probably the cause of the problem, the system isn't meant to be used that way. Quote Link to comment Share on other sites More sharing options...
opiumhautopium1 Posted February 2, 2012 Author Share Posted February 2, 2012 if there is no way to get the color i have to switch like procedure 1; begin SetDesktopAsClient; Wait(500); ActivateClient; SetOnTop(GetClientWindowHandle, true); GetClientDimensions(resolution_x, resolution_y); end; procedure 2; begin if FindWindowTitlePart('seafight.com', true) then WriteLn('seafight.com Seite gefunden') else begin WriteLn('Online Spiele Seite NICHT gefunden'); SetDesktopAsClient; end; Wait(500); ActivateClient; SetOnTop(GetClientWindowHandle, true); GetClientDimensions(resolution_x, resolution_y); end; but this dont look ~good~ if somebody have a smarter way please post it :-) mfg Quote Link to comment Share on other sites More sharing options...
FHannes Posted February 2, 2012 Share Posted February 2, 2012 You shouldn't be calling SetDesktopAsClient anywhere Quote Link to comment Share on other sites More sharing options...
opiumhautopium1 Posted February 2, 2012 Author Share Posted February 2, 2012 now i got it ........... long way thanx a lot ........ Quote Link to comment Share on other sites More sharing options...