PcExpert Posted March 6, 2006 Share Posted March 6, 2006 Hello, Does anyone know how to let the program detect a color and then run a command. For example: You have got a white box and after a couple seconds it's red. When it is red it runs your specified command. Kind Regards, PcExpert Link to comment Share on other sites More sharing options...
greenmachine Posted March 6, 2006 Share Posted March 6, 2006 PixelGetColor or PixelSearch. Link to comment Share on other sites More sharing options...
nfwu Posted March 6, 2006 Share Posted March 6, 2006 not enough info for a full script, but here is some pointers: PixelGetColor ( x , y ) <-- Get a color at the x & y location #) TwitterOut of date stuff:Scripts: Sudoku Solver | Webserver | 3D library (Pure AutoIt) | Wood's GadgetsUDFs: _WoodUniqueID() | _DialogEditIni() | _Console*() | _GetIPConfigData() | _URLEncode/Decode() Link to comment Share on other sites More sharing options...
PcExpert Posted March 6, 2006 Author Share Posted March 6, 2006 Thanks, but how van I let the program run a command when a specified color is found? Link to comment Share on other sites More sharing options...
BigDod Posted March 6, 2006 Share Posted March 6, 2006 Thanks, but how van I let the program run a command when a specified color is found?If PixelGetColor=desired colour thendo something Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 6, 2006 Moderators Share Posted March 6, 2006 If (PixelGetColor($x, $y) == $Color) Then MyFunction() EndIfComparing 2 numbers you'll need 2 '=' signs here. 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...
PcExpert Posted March 6, 2006 Author Share Posted March 6, 2006 If (PixelGetColor($x, $y) == $Color) Then MyFunction() EndIfComparing 2 numbers you'll need 2 '=' signs here. Can you please make an example of how the code woul'd look like if its is finished? Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted March 6, 2006 Moderators Share Posted March 6, 2006 (edited) $x = 100 $y = 120 $Color = 0xFFFFFF If (PixelGetColor($x, $y) == $Color) Then MyFunction() EndIf Func MyFunction() MsgBox(0, 'Found', 'The color was found at those coords') EndFuncKind of a silly question, considering we have no idea what in the world your doing. Edited March 6, 2006 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...
Helge Posted March 6, 2006 Share Posted March 6, 2006 (edited) I see that you many times ask how to do things, and where people then respond with how youcan do it yourself. Some times they even go longer and almost create the entire script for you,but even then you don't seem to try to finish it yourself. I'm sorry, but the code that Smoke gaveyou is pretty much every thing you need to know.If you don't understand it, you should do take a look at your signature..and actually work with AutoIt.Edit : me english not speak very well, noCan you please make an example of how the code woul'd look like if its is finished? Edited March 6, 2006 by Helge Link to comment Share on other sites More sharing options...
PcExpert Posted March 6, 2006 Author Share Posted March 6, 2006 How do I let the detection of the color continue until the color exists. Can I do that with Continue Loop? Link to comment Share on other sites More sharing options...
BigDod Posted March 6, 2006 Share Posted March 6, 2006 How do I let the detection of the color continue until the color exists. Can I do that with Continue Loop?Lookup Do ..... Until Time you enjoyed wasting is not wasted time ......T.S. Elliot Suspense is worse than disappointment................Robert Burns God help the man who won't help himself, because no-one else will...........My Grandmother Link to comment Share on other sites More sharing options...
PcExpert Posted March 7, 2006 Author Share Posted March 7, 2006 (edited) Thanks,PcExpert Can somebody please help me? I have tried to get it to work, but I het ERRORS, I have tried somethings but the ERRORS still show up. Can somebody place the do and until code in this script:$x = 833$y = 652$Color = 0x291808If (PixelGetColor($x, $y) == $Color) Then MyFunction()EndIfFunc MyFunction() MsgBox(0, 'Found', 'The color was found at those coords')EndFunc Kind Regards,PcExpert Edited March 7, 2006 by PcExpert Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted March 7, 2006 Share Posted March 7, 2006 (edited) no offence but his name doesnt really fit him Edited March 7, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
PcExpert Posted March 8, 2006 Author Share Posted March 8, 2006 (edited) I've got it to work now Edited March 8, 2006 by PcExpert 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