I finally completed this script. It is like ImageSearch, but it doesn't require an image file and works better for me. It has 2 functions, GetMatrix & FindMatrix.
There is an example in the script to find a 3x3 matrix.
Note: For faster searching, make sure the first pixel of matrix is not abundant on the screen.
Script
Pixel Matrix Search
Started by
Rajat
, Jun 22 2005 05:48 AM
31 replies to this topic
#1
-
Posted 22 June 2005 - 05:48 AM
CleanNews.in : Bite sized latest news headlines from India with zero bloat
Thanks for sharing this. I know ImageSearch can be cumbersome to use, and PixelSearch can often be too crude. Your solution is a great compromise.
#2
-
Posted 22 June 2005 - 08:37 PM
Hi Rajat
won't the following line (taken from your script) restrict it to a 800x600 screen resolution :?:
won't the following line (taken from your script) restrict it to a 800x600 screen resolution :?:
Thx for sharing it. 8)Result := FindMatrix(1,800,1,600,3,Matrix)
#3
-
Posted 23 June 2005 - 07:09 AM
yes it will. but its not hard-coded in the function, its just part of the example. i cud've restricted it to just the systray too.won't the following line (taken from your script) restrict it to a 800x600 screen resolution
#4
-
Posted 23 June 2005 - 09:11 AM
CleanNews.in : Bite sized latest news headlines from India with zero bloat
I might be dumb, but I don't quite understand what this is for.
If I execute the script and press F4, it returns me two values (coordinates?) - but what to do with these?
If I execute the script and press F4, it returns me two values (coordinates?) - but what to do with these?
#5
-
Posted 05 February 2006 - 02:25 PM
It searches for an 3x3 pixel color matrix on your screen. If you have pressed F4 with your mouse somewhere inside the 800x600 area of your screen. You should get back that position.
What the code does: It gets the matrix under your mouse pointer and starts to search for that matrix on your screen (the 800x600 upper left part). If it finds it it reports back the coordinates.
As Rajat said, it is faster then ImageSearch and it doesn't require an image.
You can use it to find a pattern (the 3x3 matix) on the screen if it unique. E.g. an icon, a picture or an item in a game.
What the code does: It gets the matrix under your mouse pointer and starts to search for that matrix on your screen (the 800x600 upper left part). If it finds it it reports back the coordinates.
As Rajat said, it is faster then ImageSearch and it doesn't require an image.
You can use it to find a pattern (the 3x3 matix) on the screen if it unique. E.g. an icon, a picture or an item in a game.
#6
-
Posted 05 February 2006 - 02:55 PM
Ciao
toralf
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.
toralf
I use the latest AHK version (1.1.15+)
Please ask questions in forum on ahkscript.org. Why?
For online reference please use these Docs.
its i fine script, but how can make it that my cursor jumps back
on that matrix
it shows me a little red dot and the scipt ends
on that matrix
it shows me a little red dot and the scipt ends
#8
-
Posted 15 June 2006 - 01:24 PM
just do a MouseMove at the received coordinates
#9
-
Posted 15 June 2006 - 09:01 PM
CleanNews.in : Bite sized latest news headlines from India with zero bloat
hi,
i'm very impressed with this pixel matrix thing, but i'm hoping someone can help me out
once i find my 9 by 9 matrix, what code should i input for me to save it so i can refer to it later. i would like to save a bunch of 9 by 9 matrix's and just name them matrix1.bmp and matrix2.bmp and so on, so i can search the screen for the same matrix and do the required mouseclick.
also, if i increase the matrix size to say a 4x4, the image comparison would be better right?, but would it bog down the script too much?
anyhelp is much appricated
i'm very impressed with this pixel matrix thing, but i'm hoping someone can help me out
once i find my 9 by 9 matrix, what code should i input for me to save it so i can refer to it later. i would like to save a bunch of 9 by 9 matrix's and just name them matrix1.bmp and matrix2.bmp and so on, so i can search the screen for the same matrix and do the required mouseclick.
also, if i increase the matrix size to say a 4x4, the image comparison would be better right?, but would it bog down the script too much?
GetMatrix(StartX,StartY,Dimension) { Loop, %Dimension% { Loop, %Dimension% { PixelGetColor, Pix, %StartX%, %StartY% Matrix = %Matrix%|%Pix% StartX ++ } StartY ++ StartX -= %Dimension% } StringTrimLeft, Matrix, Matrix, 1 Return %Matrix% }
anyhelp is much appricated
#10
-
Posted 11 July 2006 - 09:02 PM
with this script you can save the recd matrix in the script itself and it doesn't need a separate file. if you want to save .bmp files then u better use the imagesearch command instead of this script, as the recd matrix from this script is plain text and not an image.
the image finding would definitely be better with a bigger matrix. and just take care of the first pixel thing and you should be fine.
the image finding would definitely be better with a bigger matrix. and just take care of the first pixel thing and you should be fine.
#11
-
Posted 12 July 2006 - 12:11 AM
CleanNews.in : Bite sized latest news headlines from India with zero bloat
thanks for the quick reply.
i have tried using image search, but so far no luck
my problem is i get a screen shot, crop out the selected image i want to search for and try it out. it will find the image by itself, meaning alone.
but it won't find the image in the screen shot without it being cropped. that is why i think i need to go the matrix way.
how do i save the matrix file, can i save the text of the matrix, and use it later?
i have tried using image search, but so far no luck
my problem is i get a screen shot, crop out the selected image i want to search for and try it out. it will find the image by itself, meaning alone.
but it won't find the image in the screen shot without it being cropped. that is why i think i need to go the matrix way.
how do i save the matrix file, can i save the text of the matrix, and use it later?
#12
-
Posted 12 July 2006 - 05:05 AM
how do i save the matrix file, can i save the text of the matrix, and use it later?
yes you can, that's the point!... just like you can define a control name for most apps in scripts, for apps which don't have recognisable controls can be automated this way and the pixel matrix for its control can be retrieved from the first function and saved in the script... later on the second function can find it and do button presses etc.
#13
-
Posted 12 July 2006 - 02:41 PM
ok, i feel stupid, i've been trying this for a few hrs
please help me
i want to use the script you wrote. but instead of using the getmatrix sub function, i want to just define my matrix. i have tied some things, but i'm guessing it has to do with inputing the 9 pixels into a 3 by 3 array. i just can't do it, i'm dumb. this is my matrix in text.
0x000000|0x205D47|0x215E48|0x000000|0x1B5640|0x1C5741|0x000000|0x777777|0x18513C
can someone give me the 2-3 lines of code that replaces "getmatrix" for the matrix above. From there i should be able to continue the rest of the program
thanks
please help me
i want to use the script you wrote. but instead of using the getmatrix sub function, i want to just define my matrix. i have tied some things, but i'm guessing it has to do with inputing the 9 pixels into a 3 by 3 array. i just can't do it, i'm dumb. this is my matrix in text.
0x000000|0x205D47|0x215E48|0x000000|0x1B5640|0x1C5741|0x000000|0x777777|0x18513C
can someone give me the 2-3 lines of code that replaces "getmatrix" for the matrix above. From there i should be able to continue the rest of the program
thanks
#14
-
Posted 20 July 2006 - 04:00 PM
assuming that the matrix you posted is available on your screen, you can do this:
matrix = {your matrix}
Result := FindMatrix(1,A_ScreenWidth,1,A_ScreenHeight,9,matrix)
StringSplit, Result, Result, %A_Space%
now result1 & result2 contain the x & y coords of your target.
matrix = {your matrix}
Result := FindMatrix(1,A_ScreenWidth,1,A_ScreenHeight,9,matrix)
StringSplit, Result, Result, %A_Space%
now result1 & result2 contain the x & y coords of your target.
#15
-
Posted 20 July 2006 - 06:44 PM
CleanNews.in : Bite sized latest news headlines from India with zero bloat