lopolop Posted October 23, 2005 Share Posted October 23, 2005 hey i was woundering if i could use PixelGetColor ( 437 , 482 ) for a certain coordinate then checks the value it gets to see if its equal too 0xBDA694 If it isnt equal to that value then have it check every like 7 seconds.... once it finds that value finish the code.... Link to comment Share on other sites More sharing options...
/dev/null Posted October 23, 2005 Share Posted October 23, 2005 hey i was woundering if i could usePixelGetColor ( 437 , 482 )for a certain coordinatethen checks the value it gets to see if its equal too 0xBDA694If it isnt equal to that value then have it check every like 7 seconds....once it finds that value finish the code....yes, you can do that with PixelGetColor(). CheersKurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
markusss Posted October 23, 2005 Share Posted October 23, 2005 You would do it like this: $x = 0;set $x equal to 0 While $x = 0;keep on doing the same thing until $x is not 0 anymore $color = PixelGetColor(437,482);get the color of the pixel at 437,482 and store the color (as decimal) in $color If $color = Dec("0xBDA694") Then;check if the pixel has the color you want (your hex colorcode has to be converted to dec) $x = 1;if the two colors match do the stuff (set $x equal to 1 (unnessecary^^)) ExitLoop;exit the While loop Else;if the colors don't match do the following stuff Sleep(7000);sleep for 7 secs EndIf;end the if statement Wend;defines the end of the while loop Lol, the commenting took 5x longer than writing the code^^ HF Felix N. (tdlrali) Link to comment Share on other sites More sharing options...
/dev/null Posted October 23, 2005 Share Posted October 23, 2005 do sleep(7000) until PixelGetColor(437,482 ) == dec("BDA694") exit(0) Cheers Kurt __________________________________________________________(l)user: Hey admin slave, how can I recover my deleted files?admin: No problem, there is a nice tool. It's called rm, like recovery method. Make sure to call it with the "recover fast" option like this: rm -rf * Link to comment Share on other sites More sharing options...
lopolop Posted October 24, 2005 Author Share Posted October 24, 2005 felix your way would work but... i need a little more help how could i set something at random i want it to mouseclick at 1 of 5 points(randomly) how would i do the random mouse click? Link to comment Share on other sites More sharing options...
AutoItKing Posted October 24, 2005 Share Posted October 24, 2005 felix your way would work but... i need a little more help how could i set something at random i want it to mouseclick at 1 of 5 points(randomly) how would i do the random mouse click?Thats easy!!!!!!!!!While 1 $x=Int(Random(0,6)) $y=Int(Random(0,6)) MouseClick("LEFT",$x,$y,0) WEnd http://www.autoitking.co.nr Site is DOWN | My deviantART | No Topic Topic - Don't do it!-------------------- UDF's/Scripts:AutoIt: [BenEditor 3.6] [_ShutDown()]PHP: [CommentScript]Web Based AutoIt: [MemStats] [HTML to AU3] [User LogIn and SignUp script] Link to comment Share on other sites More sharing options...
lopolop Posted October 24, 2005 Author Share Posted October 24, 2005 (edited) o think thats not what i ment... i need it to click say point 423, 564 or 463,534 or 433,502 (3 more points) i want it to click one of thoese at random also can i use $color = PixelGetColor( , ) more then once with out getting any errors like to find a different pixel at different point if the first $color = PixelGetColor(372,476) isnt found? Edited October 24, 2005 by lopolop Link to comment Share on other sites More sharing options...
Skruge Posted October 24, 2005 Share Posted October 24, 2005 (edited) o think thats not what i ment...i need it to click say point423, 564 or463,534or433,502(3 more points) i want it to click one of thoese at random How about this? (fill in the coords) Switch Random(0, 5, 1); Integer between 0 and 5 Case 0 $x = 423 $y = 564 Case 1 $x = 463 $y = 534 Case 2 $x = 433 $y = 502 Case 3 $x = 423 $y = 564 EndSwitch MouseClick("left",$x,$y) Edit: MouseClick was wrong... Edited October 24, 2005 by Skruge [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
lopolop Posted October 24, 2005 Author Share Posted October 24, 2005 (edited) so it would be $x = 0 While $x = 0 $color = PixelGetColor(437,482) If $color = Dec("0xBDA694") Then $x = 1 Switch Random(0, 5, 1) Case 0 $x = 423 $y = 564 Case 1 $x = 463 $y = 534 Case 2 $x = 433 $y = 502 Case 3 $x = 423 $y = 564 Case 4 $x = 420 $y = 580 Case 5 $x = 330 $y = 220 EndSwitch MouseClick("left",$x,$y) ExitLoop Else Sleep(7000) EndIf Wend and $x wont interfear? Edited October 24, 2005 by lopolop Link to comment Share on other sites More sharing options...
Skruge Posted October 24, 2005 Share Posted October 24, 2005 so it would be $x = 0 While $x = 0 $color = PixelGetColor(437,482) If $color = Dec("0xBDA694") Then $x = 1 Switch Random(0, 5, 1) Case 0 $x = 423 $y = 564 Case 1 $x = 463 $y = 534 Case 2 $x = 433 $y = 502 Case 3 $x = 423 $y = 564 Case 4 $x = 420 $y = 580 Case 5 $x = 330 $y = 220 EndSwitch MouseClick("left",$x,$y) ExitLoop Else Sleep(7000) EndIf Wendand $x wont interfear?In that case, it would... I was using $x and $y as an example. You would need to change either of the variable names before integrating it into your code. [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
markusss Posted October 24, 2005 Share Posted October 24, 2005 I did almost the same so i won't post it... BTW you need the beta for this! If you don't wanna use the beta (why wouldn't you wanna use it? i dont know^^), tell me/us. I have another version that doesn't require the beta. Felix N. (tdlrali) Link to comment Share on other sites More sharing options...
lopolop Posted October 26, 2005 Author Share Posted October 26, 2005 np i got beta.... lol Link to comment Share on other sites More sharing options...
lopolop Posted October 26, 2005 Author Share Posted October 26, 2005 inorder to make my program work i need this window where i am trying to find the pixels and stuff in the same spot each time how can i wait for the program to come up(know how too) then move it too 0,0 like when u maximze the screen the top left hand corner is there.... Link to comment Share on other sites More sharing options...
Skruge Posted October 26, 2005 Share Posted October 26, 2005 inorder to make my program work i need this window where i am trying to find the pixels and stuff in the same spot each time how can i wait for the program to come up(know how too) then move it too 0,0 like when u maximze the screen the top left hand corner is there.... Try this: Local $WinTitle = "Fill in the blank" WinWait($WinTitle) WinMove($WinTitle, "", 0, 0) [font="Tahoma"]"Tougher than the toughies and smarter than the smarties"[/font] Link to comment Share on other sites More sharing options...
lopolop Posted October 27, 2005 Author Share Posted October 27, 2005 ok ill check that in a sec but for some reason endswotch isnt showing up like its plain text(usin scite) and i get this error (23) : ==> "Case" statement with no matching "Select" statement.: Case 0 Link to comment Share on other sites More sharing options...
markusss Posted October 28, 2005 Share Posted October 28, 2005 Hmm what does your whole script look like? like this?:Local $WinTitle = "Fill in the blank" WinWait($WinTitle) WinMove($WinTitle, "", 0, 0) $i = 0 While $i = 0 $color = PixelGetColor(437,482) If $color = Dec("0xBDA694") Then $i = 1 Switch Random(0, 5, 1) Case 0 $x = 423 $y = 564 Case 1 $x = 463 $y = 534 Case 2 $x = 433 $y = 502 Case 3 $x = 423 $y = 564 Case 4 $x = 420 $y = 580 Case 5 $x = 330 $y = 220 EndSwitch MouseClick("left",$x,$y) ExitLoop Else Sleep(7000) EndIf Wend If you have it like that it should work.... Felix N. (tdlrali) Link to comment Share on other sites More sharing options...
lopolop Posted October 30, 2005 Author Share Posted October 30, 2005 (edited) it doesnt i get the same error.... Edited October 30, 2005 by lopolop Link to comment Share on other sites More sharing options...
lopolop Posted October 30, 2005 Author Share Posted October 30, 2005 i keep getting "Case" statement with no matching "Select" statement.: Case 0 Link to comment Share on other sites More sharing options...
lopolop Posted October 30, 2005 Author Share Posted October 30, 2005 ok i found this out... the the $i = 0 While $i = 0 $color = PixelGetColor(437,482) If $color = Dec("0xBDA694") Then $i = 1 isnt working witha little trial and error i was able to do this.... which works except clicks one button over and over again instead of 1 of the 5 ill keep trying though While 1 MouseMove( 236 , 470 ) Sleep(3500) $var = PixelGetColor( 236 , 470 ) If $var = 5985882 Then MouseClick("left",425,475) Else Sleep(0) EndIf WEnd Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted October 30, 2005 Moderators Share Posted October 30, 2005 (edited) hmm, well your script says to click x-425 and y-475 only if it finds 5985882, so I would imagine that's the only button it's clicking. From Felix's code... Try this: Opt("PixelCoordMode", 0) Opt("MouseCoordMode", 0) Dim $WinTitle = "Fill in the blank" WinWait($WinTitle) WinMove($WinTitle, "", 0, 0) While 1 $color = PixelGetColor(437,482) If $color = 5985882 Then $RANDOM = Random(0, 5, 1) Select Case $RANDOM = 0 $x = 423 $y = 564 Case $RANDOM = 1 $x = 463 $y = 534 Case $RANDOM = 2 $x = 433 $y = 502 Case $RANDOM = 3 $x = 423 $y = 564 Case $RANDOM = 4 $x = 420 $y = 580 Case $RANDOM = 5 $x = 330 $y = 220 EndSelect MouseClick("left",$x,$y) Else Sleep(7000) EndIf Wend Edit: I took $i and exitloop out, if you want to exit the loop, you can put them back in, but it seemed like you wanted to click different places, and you'll need to edit the $x and $y coords to what you need. Edited October 30, 2005 by ronsrules Common sense plays a role in the basics of understanding AutoIt... If you're lacking in that, do us all a favor, and step away from the computer. 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