powderedonuts Posted December 24, 2007 Share Posted December 24, 2007 Hi I'm trying to incorporate into my script a command that is dependent on the color of a specific pixel on my screen. Could someone who is good at this help me out please? Basically I have a script right now for pressing space every few seconds, and I want to add in a variable that if a specific pixel on my screen was green, it would execute some button press commands, and if it wasn't green, would just do nothing and continue pressing space on a loop. How can I write in a command that is dependent on the color of a specific pixel? I can find out the coords for the pixel if you can help me for where to input them in a script, if what I want to do is possible. Thank you much! (Very new to this, one day, been reading the tutorials but im not the best at computery stuff.) Link to comment Share on other sites More sharing options...
Zedna Posted December 24, 2007 Share Posted December 24, 2007 Look at PixelGetColor function. Also post your script to get more help here. Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
powderedonuts Posted December 24, 2007 Author Share Posted December 24, 2007 oh sorry sorry, here it is. HotKeySet("{F9}","Start") HotKeySet("{F10}","End") While 1 Sleep(100) WEnd Func Start() While 1 Sleep(40000 + Random(1, 50, 1)) Send("{SPACE}") Sleep(200) Send("{SPACE}") Sleep(18000 + Random (4000, 6000, 1)) Wend EndFunc Func End() Exit EndFunc Link to comment Share on other sites More sharing options...
Zedna Posted December 24, 2007 Share Posted December 24, 2007 (edited) Maybe: HotKeySet("{F9}", "Start") HotKeySet("{F10}", "End") While 1 Sleep(100) WEnd Func Start() If Hex(PixelGetColor( 10, 100 ), 6) <> 0xFF00FF Then Return ; 0xRRGGBB While 1 Sleep(40000 + Random(1, 50, 1)) Send("{SPACE}") Sleep(200) Send("{SPACE}") Sleep(18000 + Random(4000, 6000, 1)) WEnd EndFunc ;==>Start Func End() Exit EndFunc ;==>EndEDIT: change X,Y and color accordingly Edited December 24, 2007 by Zedna Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
powderedonuts Posted December 24, 2007 Author Share Posted December 24, 2007 (edited) ok I checked out the getcolor command, and the pixel color I want it to check for and execute movements on is pixel: 90,142 dec color: 29696 hex color: 007400 So now how can I make a command that will only execute when pixel 90, 142 is this color?if the pixel is not that color I want it only to continue my space loop. tyvm for the help so far! edit: oh and the command I want to add in is some arrow movements then pressing the "1" button, if you wanted to know Edited December 24, 2007 by powderedonuts Link to comment Share on other sites More sharing options...
Zedna Posted December 24, 2007 Share Posted December 24, 2007 So now how can I make a command that will only execute when pixel 90, 142 is this color?if the pixel is not that colorI want it only to continue my space loop.Look at my previous post :-) Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
powderedonuts Posted December 24, 2007 Author Share Posted December 24, 2007 ugh Im really bad I need help on how to input the colors. HotKeySet("{F9}", "Start") HotKeySet("{F10}", "End") While 1 Sleep(100) WEnd Func Start() If Hex(PixelGetColor( 90, 142 ), 6) <> 0xFF00FF Then Return ; 0x007400 Send("{SPACE}") Sleep(200) Send("{SPACE}") Sleep(200) While 1 Sleep(40000 + Random(1, 50, 1)) Send("{SPACE}") Sleep(200) Send("{SPACE}") Sleep(18000 + Random(4000, 6000, 1)) WEnd EndFunc ;==>Start Func End() Exit EndFunc ;==>End this is wrong right? I want the two SPACE to be conditional on the color Link to comment Share on other sites More sharing options...
Zedna Posted December 24, 2007 Share Posted December 24, 2007 If Hex(PixelGetColor( 90, 142 ), 6) <> 0x007400 Then Return Resources UDF ResourcesEx UDF AutoIt Forum Search Link to comment Share on other sites More sharing options...
The Ape Posted December 24, 2007 Share Posted December 24, 2007 If Hex(PixelGetColor( 90, 142 ), 6) <> "007400" Then ;If it doesn't equal that specific green then... Send("{SPACE}") Sleep(200) Send("{SPACE}") Sleep(200) Else ;it matches that specific green and then... MouseMove ( x, y [, speed] );<<<<<<look in help file... I assume by "arrow" you mean the cursor Send("1", 1) EndIf FixJaw.comTriad-Art.com Link to comment Share on other sites More sharing options...
powderedonuts Posted December 24, 2007 Author Share Posted December 24, 2007 Oh thx very much im going to try this out now, and by arrow I meant actually like holding down the arrow key on the keyboard for a little while, but I think I can get that in there myself. Link to comment Share on other sites More sharing options...
powderedonuts Posted December 25, 2007 Author Share Posted December 25, 2007 Alright it worked, I pressed space and "1" based on the green pixel, thank you. Now I am writing in the command for the arrow press. 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