Jasio Posted January 23, 2006 Share Posted January 23, 2006 I was wondering if there was a simple script that would find a color preset in the script, i would also like to know if there is a script to fine the exact color "hex" to make detection simpler Thanks, Jasio- Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 23, 2006 Moderators Share Posted January 23, 2006 Pixelgetcolor/PixelSearch in the helpfile. 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...
Thatsgreat2345 Posted January 23, 2006 Share Posted January 23, 2006 (edited) um pixelsearch(0,0,500,500,URHEXCOLOR) us the au3info that comes with autoit i thought i was gonna beat u on this one i guess not Edited January 23, 2006 by thatsgreat2345 Link to comment Share on other sites More sharing options...
Jasio Posted January 23, 2006 Author Share Posted January 23, 2006 Ya, i tried that before coming here.. it gives me "0" for decimal, "00000" for hex.., (used from the example file), any specific way to use this command.. Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 23, 2006 Moderators Share Posted January 23, 2006 (edited) $Blah = PixelGetColor(0, 100) MsgBox(0, 'Test', '0x' & Hex($Blah, 6)) Edit: Be sure your using the Correct PixelCoordMode depending on the type of coordinates your collecting. Check out Opt('PixelCoordMode', #) in the help. Edited January 24, 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...
Jasio Posted January 23, 2006 Author Share Posted January 23, 2006 Ya.. basically the same code from the Example file.. gives me 0x00000 this time though =/ Link to comment Share on other sites More sharing options...
Thatsgreat2345 Posted January 24, 2006 Share Posted January 24, 2006 take a screenshot and put it in paint that should give u the right thing but only BMPs contain the actual hex so dont save it as a .jpg if u do save it Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 24, 2006 Moderators Share Posted January 24, 2006 (edited) Look at my edit: Edit: I typically use client coords, so I'll show you an example (to use client coords in the autoinfo tool, go to options / coord mode) Opt('PixelCoordMode', 2) $Blah = PixelGetColor(100, 100) MsgBox(0, 'Test', '0x' & Hex($Blah, 6)) P.S., the color at that time at those coordinates could have been black is why you were getting 0x000000 Edited January 24, 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...
Jasio Posted January 24, 2006 Author Share Posted January 24, 2006 (edited) Ok, worked, now for my second question, say i want the script to find this hex color, than click on its location (read full screen) and click this color.. Edited January 24, 2006 by Jasio Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 24, 2006 Moderators Share Posted January 24, 2006 (edited) Hmmm, as usual I mis-understood your post... To get the color under the mouse there are 5 things you'll want to look at in detail: 1. PixelCoordMode 2. MouseCoordMode 3. _IsPressed() A UDF that is in the Misc.au3 file of the Beta Version of Autoit (See my signature) 4. MouseGetPos 5. PixelGetColor So an example would be: (I'll include the UDF to help you a bit) Opt('PixelCoordMode', 2) Opt('MouseCoordMode', 2) While 1 If _IsPressed('01') Then; '01' identifies the left mouse button Local $Pos = MouseGetPos() $PixColor = PixelGetColor($Pos[0], $Pos[1]) ToolTip('The Colour is: 0x' & Hex($PixColor, 6)) EndIf Sleep(10) WEnd Func _IsPressed($s_hexKey, $v_dll = 'user32.dll') Local $a_R = DllCall($v_dll, "int", "GetAsyncKeyState", "int", '0x' & $s_hexKey) If Not @error And BitAND($a_R[0], 0x8000) = 0x8000 Then Return 1 Return 0 EndFunc Edit: For Search You'll use PixelSearch() Opt('PixelCoordMode', 2) Opt('MouseCoordMode', 2) Local $xTopLeft = 0; starting point Local $yTopLeft = 0; starting point Local $xBottomRight = 200 Local $yBottomRight = 200 Local $ColorToFind = 0xFF0000 While 1 Local $PixSearch = PixelSearch($xTopLeft, $yTopLeft, $xBottomRight, $yBottomRight, $ColorToFind) If Not @error And IsArray($PixSearch) Then MouseClick('Left', $PixSearch[0], $PixSearch[1], 1, 1) Sleep(100) WEnd Edited January 24, 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...
Jasio Posted January 24, 2006 Author Share Posted January 24, 2006 I'm sorry for the miscommunication, i can't seem to word them better.. This script is for a game, i would like it to find a specific color (which is basically a red/orange circle in a large grey area.. then click on it a problem im having is, when i get the hex color, E0DFE3, i put it in the PixelSearch, it then gives me coords 0, 48.. The object in which i want it to locate is in the middle of the screen and no where near the top left. I hope this clears up more of this than it complicates Thanks, Jasio Link to comment Share on other sites More sharing options...
Moderators SmOke_N Posted January 24, 2006 Moderators Share Posted January 24, 2006 I edited the above post to show you how already 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...
Jasio Posted January 24, 2006 Author Share Posted January 24, 2006 Hrmm.. It made everything really laggy.. i cancelled after about 3 minutes.. it just stood there, how long could this take to find the color.. and how do i know if it is even working 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