nOne Posted July 9, 2004 Share Posted July 9, 2004 hi folkshere my first script im posting, hope someone can use it it is able to search for a given aerea of pixels in a spezific windowyou can store the field in an file to use it later or store it in an arraybut its a litte slow on big fields because it scanes every pixel and compares itwith those you have spezified first, im trying to get it faster but havent got a good idea yet(it took my 2ghz amd to scan through 800x600 72 secs)probably one of you has an idea ? the commands are descriped in the .au3 fileLink to the Scriptprobably test it with this testscript#include "pixelfunc.au3" MsgBox(0,"Start position", "place cursor on START" & @LF & "position and press enter") $frompos = MouseGetPos() $fromx=$frompos[0] $fromy=$frompos[1] MsgBox(0,"End position", "place cursor on END" & @LF & "position and press enter") $topos = MouseGetPos() $tox=$topos[0] $toy=$topos[1] $windowname="Untiteled - Notepad" $file="test.txt" $pixel=_Pixelfieldtofile($fromx, $fromy, $tox, $toy, $file) ;$pixel=_Pixelfieldtoarray($fromx, $fromy, $tox, $toy) MsgBox(0,"status", $pixel) $pixelarray=_Pixelfieldsearchfromfile($file, $windowname) ;$pixelarray=_Pixelfieldsearchfromarray($pixel, $windowname) if isarray($pixelarray) Then MouseMove($pixelarray[0],$pixelarray[1],10) MsgBox(0,"returnwert", "fromx = " & $fromx & @LF & "fromy = " & $fromy & @LF & "tox = " & $tox & @LF & "toy = " & $toy & @LF & @LF & "startx = " & $pixelarray[0] & @LF & "starty = " & $pixelarray[1] & @LF & "endx = " & $pixelarray[2 ] & @LF & "endy = " & $pixelarray[3]) MouseMove($pixelarray[2],$pixelarray[3],10) MsgBox(0,"returnwert", "fromx = " & $fromx & @LF & "fromy = " & $fromy & @LF & "tox = " & $tox & @LF & "toy = " & $toy & @LF & @LF & "startx = " & $pixelarray[0] & @LF & "starty = " & $pixelarray[1] & @LF & "endx = " & $pixelarray[2 ] & @LF & "endy = " & $pixelarray[3]) else MsgBox(0,"returnwert", "wert = " & $pixelarray) endifim sorry for my grammar, its terrible Link to comment Share on other sites More sharing options...
ezzetabi Posted July 13, 2004 Share Posted July 13, 2004 Interesting, can be used to find a icon in the systray? Link to comment Share on other sites More sharing options...
Guest tekky Posted September 13, 2004 Share Posted September 13, 2004 am i correct in assuming that this will locate a string of text via pixel colors on the screen? or could we get a better description of what it does? Thanks Link to comment Share on other sites More sharing options...
mcfr1es Posted September 14, 2004 Share Posted September 14, 2004 (edited) to make it faster, try implementing a step feature, where the user inputs step # and script would search for every other pixel if step = 2 or every 3 pixels if step = 4 etc. is "untitled" supposed to be misspelled? Edited September 14, 2004 by mcfr1es Roger! You son of a big pile o' Monkey Nuts. Link to comment Share on other sites More sharing options...
ZeDMIN Posted September 14, 2004 Share Posted September 14, 2004 (edited) OR NOT stringisint($userfile) very funny ... i've never seen an integer file another bug: Func _Pixelfieldsearchfromfile($userfile, $windowname, $mode) $file = FileOpen($userfile, 0) if @error = -1 Then FileClose($file) return -1 The error code is written in $file. (and btw: why close a file which hasnt been opened?) Func _Pixelfieldsearchfromfile($userfile, $windowname, $mode) $file = FileOpen($userfile, 0) if $file = -1 Then return -1 there's missing a parameter in your example (at least it didnt work here without it): $pixelarray=_Pixelfieldsearchfromfile($file, $windowname) has to be: $pixelarray=_Pixelfieldsearchfromfile($file, $windowname, 1) Just an idea: To let the user know, where your search is u could move the mouse to the corresponding line (not to exact pixel, else it would get slower). So you can see, if it is still running and how far it got. All in all it's a nice idea. Keep on working on it. Greetings, ZeD P.S. LOL, i just saw the post is some months old. i guess he's not looking here any more Edited September 14, 2004 by ZeDMIN Link to comment Share on other sites More sharing options...
Konan--M Posted September 21, 2004 Share Posted September 21, 2004 Im just writing a script which compares the Pixels from the place where u got them with the pixels that are currently on the screen (at the same position) - thats much faster - but if the position has changed it doesnt work... Script (Based on none's script coming soon) It can be used for checking a active Window (maybe for Games) if a special element is active 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