Guest KidIcarus Posted June 15, 2005 Share Posted June 15, 2005 I am using AutoItX v3.1.1 with Visual Basic .NET. The PixelSearch function doesn't seem to be working for me. The string it returns is always empty not matter what variables I pass in. There is also no error when I check the error flag. Anyone able to get PixelSearch to wotk in AutoItX? Link to comment Share on other sites More sharing options...
Rraney Posted October 18, 2005 Share Posted October 18, 2005 Did you ever get a response to this? I just ran into the same problem when looking for a Red read flag in an old legacy application. I am using AutoItX v3.1.1 with Visual Basic .NET. The PixelSearch function doesn't seem to be working for me. The string it returns is always empty not matter what variables I pass in. There is also no error when I check the error flag. Anyone able to get PixelSearch to wotk in AutoItX? Link to comment Share on other sites More sharing options...
Valuater Posted October 18, 2005 Share Posted October 18, 2005 take a look at thishttp://www.autoitscript.com/forum/index.ph...st=0&p=1158118) Link to comment Share on other sites More sharing options...
Rraney Posted October 18, 2005 Share Posted October 18, 2005 I must be missing something in that thread. Im using AutoItX and have the problemExample in Python when using the PixelSearch function of The AutoItX.dllimport win32com.client o = win32com.client.Dispatch( "AutoItX3.Control" ) # ----------- Configure defaults for AutoItX ----------------- o.AutoItSetOption("SendKeyDelay", 5) #making sure its the default setting of 5 o.AutoItSetOption("ColorMode", 0) #make sure we are RGB mode o.AutoItSetOption("PixelCoordMode",1) #make sure we are in absolute screen Coord mode Get color at x,y # ----------------------------------------------------------------------------- def GetColor(x,y): rcolor = o.PixelGetColor(x,y) return rcolor p = GetColor(20,20) z = o.PixelSearch(1,1,50,50, p) print zWhen ran, you get the following >>> z u'1'Is that a string with the Coords? what format do I use to read it? take a look at thishttp://www.autoitscript.com/forum/index.ph...st=0&p=1158118) Link to comment Share on other sites More sharing options...
Valuater Posted October 18, 2005 Share Posted October 18, 2005 Very Sorry... this is not for autoitX 8( Link to comment Share on other sites More sharing options...
dBeau Posted October 19, 2005 Share Posted October 19, 2005 (edited) Me too... I am using AutoItX v3.1.1 with Visual Basic .NET. The PixelSearch function doesn't seem to be working for me. The string it returns is always empty not matter what variables I pass in. There is also no error when I check the error flag. Anyone able to get PixelSearch to wotk in AutoItX?Im seeing the same thing when using AutoIt3x from python. The string I get back is either emptyor "1", but never anything else. It's also odd that when doing a big search (1,1,1000,1000) for for 0x000000, it returns instantly, but when searching for 0x000001 it takes some time.Anyone else? Edited October 19, 2005 by dBeau Link to comment Share on other sites More sharing options...
Rraney Posted October 19, 2005 Share Posted October 19, 2005 And I thought I was going crazy with this. I rewrote most of my python code in perl today and still am seeing the same problem. Also the time issue is true too. - RRMe too... Im seeing the same thing when using AutoIt3x from python. The string I get back is either emptyor "1", but never anything else. It's also odd that when doing a big search (1,1,1000,1000) for for 0x000000, it returns instantly, but when searching for 0x000001 it takes some time.Anyone else? Link to comment Share on other sites More sharing options...
dBeau Posted October 19, 2005 Share Posted October 19, 2005 I'd have to guess that at least part of the problem that the length of the return stringis not getting set properly. I'd love to see the sources to confirm. I cant even imaginewhat would cause the time issue.And I thought I was going crazy with this. I rewrote most of my python code in perl today and still am seeing the same problem. Also the time issue is true too. - RR Link to comment Share on other sites More sharing options...
Richard Robertson Posted October 20, 2005 Share Posted October 20, 2005 Pixel search is very slow. What are you using it for? Link to comment Share on other sites More sharing options...
Rraney Posted October 20, 2005 Share Posted October 20, 2005 Currently, I am using it for hunting down red flags within a window. The email application is graphical simulation of a Palm PDA. Pixel search is very slow. What are you using it for? Link to comment Share on other sites More sharing options...
ramadash Posted November 27, 2005 Share Posted November 27, 2005 I noticed the same thing, so I made my own function, it works 100% private int[] PixelSearch(int startX,int startY,int rangeX,int rangeY, int step,int color) { for(int x=startX;x<startX+rangeX;x+=step) { for(int y=startY;y<startY+rangeY;y+=step) { if(autoit.PixelGetColor(x,y)==color) return new int[]{x,y}; } } throw new ApplicationException("PixelSearch: Failed to find the color ("+color.ToString()+")"); } Link to comment Share on other sites More sharing options...
Richard Robertson Posted November 28, 2005 Share Posted November 28, 2005 Why would you throw an exception? Why not just return null? Link to comment Share on other sites More sharing options...
Rraney Posted December 6, 2005 Share Posted December 6, 2005 Have you seen an problems with a hit on speed? I started to do this a month ago, but was worried it might be slow not being native CPU code. I might be missing this in your included code, but did you manage copy PixelSearch's shade-variation option ? The PDA code I need to test often shifts the colors depending on what else might be running. I noticed the same thing, so I made my own function, it works 100% private int[] PixelSearch(int startX,int startY,int rangeX,int rangeY, int step,int color) { for(int x=startX;x<startX+rangeX;x+=step) { for(int y=startY;y<startY+rangeY;y+=step) { if(autoit.PixelGetColor(x,y)==color) return new int[]{x,y}; } } throw new ApplicationException("PixelSearch: Failed to find the color ("+color.ToString()+")"); } Link to comment Share on other sites More sharing options...
ramadash Posted December 9, 2005 Share Posted December 9, 2005 I throw an exception because... I have no clue actually lol, im not a programmer just doing this for fun and I was playing with exception handling when I made this code. and also I didn't put shade variation, this was needed for pixel searchs with predefined colors with 0-shade, but it would be a nice idea actually yes. and speed looks the same, havent saw any difference from default autoit pixelsearch function. Link to comment Share on other sites More sharing options...
zaduma Posted January 15, 2007 Share Posted January 15, 2007 It is quite frustrating to get it to work in .NET, but with a little time it is simple. CODEdim x as integer dim y as integer dim search as object search = (your autoitx control variable).PixelSearch(left,top,right,bottom,color,Nvar?,step) x = search(0) y = search(1) Link to comment Share on other sites More sharing options...
zaduma Posted January 15, 2007 Share Posted January 15, 2007 It is quite frustrating to get it to work in .NET, but with a little time it is simple. CODEdim x as integer dim y as integer dim search as object search = (your autoitx control variable).PixelSearch(left,top,right,bottom,color,Nvar?,step) x = search(0) y = search(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