mrtgtr Posted December 16, 2014 Share Posted December 16, 2014 (edited) Func OTUR() While 1 PixelSearch(976, 140, 990, 147, 0x020202, 5) PixelSearch(976, 193, 990, 199, 0x020202, 5) PixelSearch(976, 245, 990, 252, 0x020202, 5) PixelSearch(976, 296, 990, 303, 0x020202, 5) PixelSearch(976, 349, 990, 356, 0x020202, 5) PixelSearch(976, 402, 990, 409, 0x020202, 5) PixelSearch(976, 453, 990, 460, 0x020202, 5) PixelSearch(976, 505, 990, 512, 0x020202, 5) If @error Then Sleep(50) Send("{c down}") Sleep(50) Send("{c up}") Do Sleep(100) Until Not @error EndIf WEnd EndFunc ;==>OTUR Hello, I want to if cordinates are not black then press c one time and sleep until to cordinates are red, then when cordinates is red press c one time again. My loop is must be like this but my script pressing c key continuously ( when cordinates are black , red...) I hope I explain my problem sorry for my bad english. Edited December 16, 2014 by Jos Run code through tidy Link to comment Share on other sites More sharing options...
Developers Jos Posted December 16, 2014 Developers Share Posted December 16, 2014 (edited) Maybe you need to rethink the logic of your script as this is not even close. Reviewing your history here in this forum I think there is a slim chance this thread stays open for a long time. Jos Edited December 17, 2014 by Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
mrtgtr Posted December 16, 2014 Author Share Posted December 16, 2014 (edited) Maybe you need to rethink the logic of your script as this is not even close. Reviewing your history here in this forum I think there is a slim chance this thread stays open for a long time. Jos I can do with PixelGetColor and work good. (below) Func OTUR() While 1 If PixelGetColor(990, 146, 7) <> 0x0000000 Then If PixelGetColor(990, 199, 7) <> 0x0000000 Then If PixelGetColor(990, 251, 7) <> 0x0000000 Then If PixelGetColor(990, 303, 7) <> 0x0000000 Then If PixelGetColor(990, 356, 7) <> 0x0000000 Then If PixelGetColor(990, 408, 7) <> 0x0000000 Then If PixelGetColor(990, 460, 7) <> 0x0000000 Then If PixelGetColor(990, 512, 7) <> 0x0000000 Then Sleep(50) Send("{c down}") Sleep(50) Send("{c up}") Do Sleep(100) Until PixelGetColor(990, 146, 7) = 0x0000000 Or PixelGetColor(990, 199, 7) = 0x0000000 Or PixelGetColor(990, 251, 7) = 0x0000000 Or PixelGetColor(990, 303, 7) = 0x0000000 Or PixelGetColor(990, 356, 7) = 0x0000000 Or PixelGetColor(990, 408, 7) = 0x0000000 Or PixelGetColor(990, 460, 7) = 0x0000000 Or PixelGetColor(990, 512, 7) = 0x0000000 EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf WEnd EndFunc ;==>OTUR I want to do this with pixelsearch for work smooth, but did not. Edited December 17, 2014 by Jos Tydied source Link to comment Share on other sites More sharing options...
Developers Jos Posted December 17, 2014 Developers Share Posted December 17, 2014 That doesn't look any better. AutID 1 SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted December 17, 2014 Moderators Share Posted December 17, 2014 mrtgtr, it looks like your keyboard threw up. Can you please explain in detail what you're trying to accomplish, what application window you're trying to manipulate, and perhaps a screenshot? Help us help you "Profanity is the last vestige of the feeble mind. For the man who cannot express himself forcibly through intellect must do so through shock and awe" - Spencer W. Kimball How to get your question answered on this forum! Link to comment Share on other sites More sharing options...
computergroove Posted December 17, 2014 Share Posted December 17, 2014 I can do with PixelGetColor and work good. (below) Func OTUR() While 1 If PixelGetColor(990, 146, 7) <> 0x0000000 Then If PixelGetColor(990, 199, 7) <> 0x0000000 Then If PixelGetColor(990, 251, 7) <> 0x0000000 Then If PixelGetColor(990, 303, 7) <> 0x0000000 Then If PixelGetColor(990, 356, 7) <> 0x0000000 Then If PixelGetColor(990, 408, 7) <> 0x0000000 Then If PixelGetColor(990, 460, 7) <> 0x0000000 Then If PixelGetColor(990, 512, 7) <> 0x0000000 Then Sleep(50) Send("{c down}") Sleep(50) Send("{c up}") Do Sleep(100) Until PixelGetColor(990, 146, 7) = 0x0000000 Or PixelGetColor(990, 199, 7) = 0x0000000 Or PixelGetColor(990, 251, 7) = 0x0000000 Or PixelGetColor(990, 303, 7) = 0x0000000 Or PixelGetColor(990, 356, 7) = 0x0000000 Or PixelGetColor(990, 408, 7) = 0x0000000 Or PixelGetColor(990, 460, 7) = 0x0000000 Or PixelGetColor(990, 512, 7) = 0x0000000 EndIf EndIf EndIf EndIf EndIf EndIf EndIf EndIf WEnd EndFunc ;==>OTUR I want to do this with pixelsearch for work smooth, but did not. If by smooth you mean fast then you're out of luck. Pixelsearch is slow. Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
computergroove Posted December 17, 2014 Share Posted December 17, 2014 While 1 Local $xPos1 = 990 Local $yPos1 = 146 For $i=1 To 8 Local $C1 = PixelGetColor($xPos1,$yPos1,7) If $C1 <> 0x000000 Then Sleep(50) Send("{c down}") Sleep(50) Send("{c up}") EndIf $yPos1 += 52 WEnd This will probably do what you want it to do. Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
MikahS Posted December 17, 2014 Share Posted December 17, 2014 I would let OP answer this question before an answer is given. Can you please explain in detail what you're trying to accomplish, what application window you're trying to manipulate, and perhaps a screenshot? Help us help you Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Bert Posted December 17, 2014 Share Posted December 17, 2014 I can see the 2 X 4 getting a workout here for I agree with Jos.... The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 17, 2014 Moderators Share Posted December 17, 2014 (edited) Although the code really leaves little to be desired, and we all have our own ideas of what's going on, ... the OP doesn't "need" to do anything. They asked a straight forward question using specific code that doesn't prove to be malicious or concerning. In all seriousness, why even post in this thread if you're going to be monotonous? If you're going to be that way, there was a chat forum designed for you. @mrtgtr What the is "7" for in PixelGetColor(xpos, ypos, hwnd) hwnd parameter? Obviously computergroove knows? From looking at the first code, I'm going to assume you think that putting 7 there is the number of pixels it will search top to bottom? Using this as a basis of that hypothesis: PixelSearch(976, 140, 990, 147, 0x020202, 5) 1. You're not looking for 0x000000 in the above like you are in your PixelGetColor() queries. 2. You're looking for 5 shades below or up from 0x020202 3. You're not checking @error after every pixelsearch. pseudo code for first post: expandcollapse popupFunc OTUR() Local $iErr While 1 PixelSearch(976, 140, 990, 147, 0x000000) If @error Then $iErr += 1 PixelSearch(976, 193, 990, 199, 0x000000) If @error Then $iErr += 1 PixelSearch(976, 245, 990, 252, 0x000000) If @error Then $iErr += 1 PixelSearch(976, 296, 990, 303, 0x000000) If @error Then $iErr += 1 PixelSearch(976, 349, 990, 356, 0x000000) If @error Then $iErr += 1 PixelSearch(976, 402, 990, 409, 0x000000) If @error Then $iErr += 1 PixelSearch(976, 453, 990, 460, 0x000000) If @error Then $iErr += 1 PixelSearch(976, 505, 990, 512, 0x000000) If @error Then $iErr += 1 If $iErr = 8 Then ; number of pixelsearch calls ; unsure why you are sending up and down with a delay like that ; but sure you have your reasons Sleep(50) Send("{c down}") Sleep(50) Send("{c up}") ; the below code is redundant, a sleep() only would be fine #cs Do Sleep(100) Until Not @error #ce EndIf Sleep(10) $iErr = 0 WEnd EndFunc ;==>OTUR Edited December 17, 2014 by SmOke_N 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...
mrtgtr Posted December 17, 2014 Author Share Posted December 17, 2014 Although the code really leaves little to be desired, and we all have our own ideas of what's going on, ... the OP doesn't "need" to do anything. They asked a straight forward question using specific code that doesn't prove to be malicious or concerning. In all seriousness, why even post in this thread if you're going to be monotonous? If you're going to be that way, there was a chat forum designed for you. @mrtgtr What the is "7" for in PixelGetColor(xpos, ypos, hwnd) hwnd parameter? Obviously computergroove knows? From looking at the first code, I'm going to assume you think that putting 7 there is the number of pixels it will search top to bottom? Using this as a basis of that hypothesis: 1. You're not looking for 0x000000 in the above like you are in your PixelGetColor() queries. 2. You're looking for 5 shades below or up from 0x020202 3. You're not checking @error after every pixelsearch. pseudo code for first post: expandcollapse popupFunc OTUR() Local $iErr While 1 PixelSearch(976, 140, 990, 147, 0x000000) If @error Then $iErr += 1 PixelSearch(976, 193, 990, 199, 0x000000) If @error Then $iErr += 1 PixelSearch(976, 245, 990, 252, 0x000000) If @error Then $iErr += 1 PixelSearch(976, 296, 990, 303, 0x000000) If @error Then $iErr += 1 PixelSearch(976, 349, 990, 356, 0x000000) If @error Then $iErr += 1 PixelSearch(976, 402, 990, 409, 0x000000) If @error Then $iErr += 1 PixelSearch(976, 453, 990, 460, 0x000000) If @error Then $iErr += 1 PixelSearch(976, 505, 990, 512, 0x000000) If @error Then $iErr += 1 If $iErr = 8 Then ; number of pixelsearch calls ; unsure why you are sending up and down with a delay like that ; but sure you have your reasons Sleep(50) Send("{c down}") Sleep(50) Send("{c up}") ; the below code is redundant, a sleep() only would be fine #cs Do Sleep(100) Until Not @error #ce EndIf Sleep(10) $iErr = 0 WEnd EndFunc ;==>OTUR thanx I will try now, 5 is color tolerance at pixelsearch 7 is color tolerance at pixelgetcolor, same thing Link to comment Share on other sites More sharing options...
JohnOne Posted December 18, 2014 Share Posted December 18, 2014 7 is color tolerance at pixelgetcolor, same thing wrong, look again AutoIt Absolute Beginners Require a serial Pause Script Video Tutorials by Morthawt ipify Monkey's are, like, natures humans. Link to comment Share on other sites More sharing options...
computergroove Posted December 18, 2014 Share Posted December 18, 2014 While 1 Local $Color = PixelSearch(990,146,990,512,0x000000,7,52) If $Color <> 0x000000 Then Sleep(50) Send("{c down}") Sleep(50) Send("{c up}") EndIf Sleep(100) WEnd Is this right? Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 18, 2014 Moderators Share Posted December 18, 2014 While 1 Local $Color = PixelSearch(990,146,990,512,0x000000,7,52) If $Color <> 0x000000 Then Sleep(50) Send("{c down}") Sleep(50) Send("{c up}") EndIf Sleep(100) WEnd Is this right? Seriously? Please look at the functions themselves and what each parameter is before attempting to help someone. What is 52 supposed to represent in the hwnd parameter? @mrtgtr As I said, you put 7 in the hwnd parameter. It has zero to do with tolerance for PixelGetColor. 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...
computergroove Posted December 18, 2014 Share Posted December 18, 2014 (edited) Seriously? Please look at the functions themselves and what each parameter is before attempting to help someone. What is 52 supposed to represent in the hwnd parameter? @mrtgtr As I said, you put 7 in the hwnd parameter. It has zero to do with tolerance for PixelGetColor. While 1 Local $Color = PixelSearch(990,146,990,512,0x000000,7,52);(XPos1,YPos1,XPos2,YPos2,color to scan for,variance for the color,skip 52 pixels to speed up search) If $Color <> 0x000000 Then;If the color isn't black then do the following Sleep(50) Send("{c down}") Sleep(50) Send("{c up}") EndIf Sleep(100) WEnd I think you need to look again. I believe I did it right. Edited December 18, 2014 by computergroove Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 18, 2014 Moderators Share Posted December 18, 2014 (edited) Indeed, I was caught up on your original post with the 7 in pixelgetcolor, then saw another you posted without working code, and reacted hastily, my apologies. Edit: But again, without changing the y value, you're repeating the same thing over and over without checking the other variants. Are you sure what 52 pixels you're stepping in, probably x and y, and since x was always fixed in the OP original answer, that could be a huge issue. Anyway, enough, help away. Edited December 18, 2014 by SmOke_N 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...
computergroove Posted December 18, 2014 Share Posted December 18, 2014 (edited) I use pixelsearch however I am more fond of pixelgetcolor. PixelSearch starts on the top left corner of the x1,y1 coords and checks the color then it goes to x1, y1+1 and checks and then x1,y1+2 etc until it gets to the end of the search x axis then it goes to x2,y1 and so on. The 52 was approximately what he was doing in his first post. I am skipping 52 pixels and it is looping on the x axis which is 1 pixel high. If I say step 52 pixels it will process as search x1,y1 then look for the color then look at x1,y53 (maybe y52 but I dont think so). Edited December 18, 2014 by computergroove Get Scite to add a popup when you use a 3rd party UDF -> http://www.autoitscript.com/autoit3/scite/docs/SciTE4AutoIt3/user-calltip-manager.html Link to comment Share on other sites More sharing options...
MikahS Posted December 18, 2014 Share Posted December 18, 2014 (edited) In all seriousness, why even post in this thread if you're going to be monotonous? If you're going to be that way, there was a chat forum designed for you. I do not like to help game automation. Just have a look at a small snippet from a topic that was locked: Sleep(100) Send("{p DOWN}") Sleep(150) Send("{p UP}") $ATAKBOX = True $TOPLUCEKBOX = True $BUFBOX = True Another: PixelSearch( 160, 67, 160, 67, 0x000000 ) If Not @error Then Send("{1 down}") sleep(50) Send("{1 up}") And again, they duck the questions with an almost identical script in this >topic Please, don't bash people trying to help you. This is obviously game automation and it's very obvious to see. Edited December 18, 2014 by MikahS Snips & Scripts My Snips: graphCPUTemp ~ getENVvarsMy Scripts: Short-Order Encrypter - message and file encryption V1.6.1 ~ AuPad - Notepad written entirely in AutoIt V1.9.4 Feel free to use any of my code for your own use. Forum FAQ Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted December 18, 2014 Moderators Share Posted December 18, 2014 (edited) I do not like to help game automation. Just have a look at a small snippet from a topic that was locked: Sleep(100) Send("{p DOWN}") Sleep(150) Send("{p UP}") $ATAKBOX = True $TOPLUCEKBOX = True $BUFBOX = True Another: PixelSearch( 160, 67, 160, 67, 0x000000 ) If Not @error Then Send("{1 down}") sleep(50) Send("{1 up}") And again, they duck the questions with an almost identical script in this >topic Please, don't bash people trying to help you. This is obviously game automation and it's very obvious to see. @Mikahs The OP's 3 lines of code without context doesn't tell you what it is. It's not against the rules to ask for help. They can ask for help on anything they want, as long as they don't prove to be asking for game automation help. People all to often put their two cents in on posts they truly have no idea what the OP post is all about, they simply assume. Bottom line, it may be game automation, it may not. If you have questions about it, don't post in the thread. Eventually the person will make a mistake in that thread or another, there's no need for a lynch mob. Don't get me wrong, I really do appreciate the help. But Jos had this handled, didn't need people others chiming in. Edited December 18, 2014 by SmOke_N 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...
Developers Jos Posted December 18, 2014 Developers Share Posted December 18, 2014 Don't get me wrong, I really do appreciate the help. But Jos had this handled, didn't need people others chiming in. Totally agree! @MikahS: All you could do is report the post when you feel there is something wrong, but in this case I was the first to respond so simply stay out and let me handle it. Jos SciTE4AutoIt3 Full installer Download page - Beta files Read before posting How to post scriptsource Forum etiquette Forum Rules Live for the present, Dream of the future, Learn from the past. 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