yeads Posted June 24, 2015 Share Posted June 24, 2015 is there a alternative to pixelsearch? something that is precise. Link to comment Share on other sites More sharing options...
kaisies Posted June 24, 2015 Share Posted June 24, 2015 Depends. What is this for? Link to comment Share on other sites More sharing options...
Moderators JLogan3o13 Posted June 25, 2015 Moderators Share Posted June 25, 2015 As kaisies points out, it is a bit difficult to give you alternatives if we don't know what you're trying to do. In short answer, yes there is almost always something better and more precise than pixelsearch. What that something is will depend on your intended goal. "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...
yeads Posted June 25, 2015 Author Share Posted June 25, 2015 like if i want to make the cursor click on 'b' in a "abc" string. They all have the same color so how can i tell them apart?xy Position wont work either. Link to comment Share on other sites More sharing options...
Xandy Posted June 25, 2015 Share Posted June 25, 2015 (edited) Check for more than one pixel, compare the results to an array of character pixel data. I have never done this with variable-width fonts but if one were so inclined it might be possible to do by figuring out the first letter then stepping that letter's width. Then solve the next letter and step again the last letter's width. Edited June 25, 2015 by Xandy Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Bert Posted June 25, 2015 Share Posted June 25, 2015 like if i want to make the cursor click on 'b' in a "abc" string. They all have the same color so how can i tell them apart?xy Position wont work either.how about reading the string in the control? The Vollatran project My blog: http://www.vollysinterestingshit.com/ Link to comment Share on other sites More sharing options...
Xandy Posted June 25, 2015 Share Posted June 25, 2015 (edited) REMOVED - See Malkey's awesome example below. Edited June 26, 2015 by Xandy My code was incomplete nonsense. Malkey's example is superior. Human Male Programmer (-_-) Xandy About (^o^) Discord - Xandy Programmer MapIt (Tile world editor, Image Tile Extractor, and Game Maker) Link to comment Share on other sites More sharing options...
Malkey Posted June 25, 2015 Share Posted June 25, 2015 (edited) This example will select an individual character out of a text field when that character is clicked on.This example will not select characters from an image, where OCR is needed.#include <Misc.au3> #include <Clipboard.au3> ;Opt("MouseCoordMode", 1) ;1=absolute(default), 0=relative, 2=client Local $aMPos, $sMsg MsgBox(0, "Instructions", '"Left mouse click" on a character,' & @LF & ' or,' & @LF & 'Press "Esc" to Exit.' & @LF & @LF & 'Press "Ok" to continue') While 1 Select Case _IsPressed("1B") ; Esc button ExitLoop Case _IsPressed("01") ; Left mouse button $aMPos = MouseGetPos() MouseMove($aMPos[0] + 5, $aMPos[1], 1) Do ; Prevents multiple mouse clicks - ensures one click only. Sleep(10) Until Not _IsPressed("01") ; Left mouse button is released ControlSend("", "", "", "^c") ; "" specifies the currently active control. Copies the highlighted text in that control. If _ClipBoard_GetData() = "" Then $sMsg = "Cursor not over a specific character when clicked" Else $sMsg = 'Clicked on"' & StringLeft(ClipGet(), 1) & '" at absolute coordinates (' & $aMPos[0] & ", " & $aMPos[1] & ")" & @LF & @LF & _ 'Note:' & @LF & 'Press "Esc" to Exit.' EndIf MsgBox(0, "Result", $sMsg, 3) _ClipBoard_SetData("") ; Could not get the script to work properly using ClipPut("") ; EndSelect WEndWhen working with strings, using the PixelSearch function would be way down on the list of possible functions to use.See String functions in AutoIt help file. Edited June 26, 2015 by Malkey Changed occurences of "Ecs" to "Esc". Xandy 1 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