tech2 Posted January 29, 2009 Share Posted January 29, 2009 hi first off im a newbie and need a lil help with with a macro im making. PixelSearch( 907, 630, 907, 630, 0xFFFFFF ) ok when that is true i want to preform an action like mouse click then when it can not find 0xFFFFFF anymore it preforms another mouseclick. hope not too confusing Link to comment Share on other sites More sharing options...
SpookMeister Posted January 29, 2009 Share Posted January 29, 2009 Instead of PixelSearch, you probably want to use PixelGetColor because PixelSearch does not return true/false per se, instead it returns an array of the coordinates where it finds the color you want (or returns an error). [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
tech2 Posted January 30, 2009 Author Share Posted January 30, 2009 Instead of PixelSearch, you probably want to use PixelGetColor because PixelSearch does not return true/false per se, instead it returns an array of the coordinates where it finds the color you want (or returns an error).can u give me an example with pixelgetcolor with wat i was asking? Link to comment Share on other sites More sharing options...
jebus495 Posted January 30, 2009 Share Posted January 30, 2009 $color = PixelGetColor(907,630) If $color = 0xFFFFFF Then MsgBox(0,"color is white") Else MsgBox(0,"color is not white) EndIf ? If you could give a more detailed explanation of what you are trying to do that might help. Link to comment Share on other sites More sharing options...
tech2 Posted January 30, 2009 Author Share Posted January 30, 2009 $color = PixelGetColor(907,630)If $color = 0xFFFFFF ThenMsgBox(0,"color is white")ElseMsgBox(0,"color is not white)EndIf?If you could give a more detailed explanation of what you are trying to do that might help. for instance if the coridents (907,630) are 0xFFFFFF it does nothing but when 0xFFFFFF changes to 0xertfde MsgBox(0,"color changed")are even only MsgBox(0,"color changed") when (907,630) = 0xertfde Link to comment Share on other sites More sharing options...
SpookMeister Posted January 30, 2009 Share Posted January 30, 2009 (edited) HotKeySet("{ESC}", "Terminate") $x = 907 $y = 630 $LastColor = PixelGetColor($x, $y) While 1 Sleep(100) ; always a good idea to avoid max'ing your CPU $check = PixelGetColor($x, $y) ToolTip($check) ; Just for testing Select Case $check <> $LastColor Select Case $check = 0xFFFFFF ; You may need to tweak this value MouseClick("left", 123, 456) ; adjust to where you want to click Case $check = 0x000000 ; some other value, again tooltip should tell you MouseClick("left", 300, 300) ; again adjust to where you want to click EndSelect EndSelect WEnd Func Terminate() Exit 0 EndFunc ;==>Terminate [edit] tweaked code a bit to make it simpler [/edit] Edited January 30, 2009 by SpookMeister [u]Helpful tips:[/u]If you want better answers to your questions, take the time to reproduce your issue in a small "stand alone" example script whenever possible. Also, make sure you tell us 1) what you tried, 2) what you expected to happen, and 3) what happened instead.[u]Useful links:[/u]BrettF's update to LxP's "How to AutoIt" pdfValuater's Autoit 1-2-3 Download page for the latest versions of Autoit and SciTE[quote]<glyph> For example - if you came in here asking "how do I use a jackhammer" we might ask "why do you need to use a jackhammer"<glyph> If the answer to the latter question is "to knock my grandmother's head off to let out the evil spirits that gave her cancer", then maybe the problem is actually unrelated to jackhammers[/quote] Link to comment Share on other sites More sharing options...
GameGuard Posted February 20, 2009 Share Posted February 20, 2009 pls refer to http://www.autoitscript.com/forum/index.ph...27&hl=mouse Link to comment Share on other sites More sharing options...
GameGuard Posted February 20, 2009 Share Posted February 20, 2009 correction .. pls refer this>> Mouse Location Pointer 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