What is the best way to getpixelcolor> or all pixels inside of an area that is 15x14 pixels.
the only way i can think of would require me to make 210 variables and 210 copy and pasted sections of code and then changing the name of each variable and pixel in each one.
I would also like to save the pixel colors to a notepad file or some file that I can copy and paste into excel and then sort the pixel colors and then count them manually to see which colors show up most frequently.
Is there a way to do this easier than so much copy and paste?
getpixelcolor of all pixels in a 15x14 box
Moderators: JRL, Dorian (MJT support)
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Use two nested loops, one for the x coords and one for the y coords and put the results in an array. You then output contents of array to text file.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Similar question and answer here:
http://www.mjtnet.com/forum/viewtopic.php?t=401
http://www.mjtnet.com/forum/viewtopic.php?t=401
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
i dont know how to use an array or what it is really. the help file shows these examples:
Let>Names[1]=Fred
Let>Names[2]=Sally
Let>Names[3]=Geoff
Let>k=2
Message>Names[%k%]
Let>Names[%k%]=Louise
does this mean that I would have to type in 210 different variables manually.
this example in the help file really didnt tell me anything about arrays whatsoever.
I know how to get pixel from each location
//Get pixel colorS
//x and y coords are where the search will begin
Let>x=0
Let>y=0
Let>xcount=15
Let>ycount=14
Label>Loop
GetPixelColor>x,y,HOW DO I SIGN THIS VALUE TO A BUNCH OF DIFFERENT VARIABLES
If>%x%NextColumn
Let>x=%x%+1
Goto>Loop
Label>NextRow
If>%y%=%ycount%,END
Let>y=%y%+1
Let>x=0
Goto>Loop
Label>END
how do i save the file to text?
how do i make arrays?
Let>Names[1]=Fred
Let>Names[2]=Sally
Let>Names[3]=Geoff
Let>k=2
Message>Names[%k%]
Let>Names[%k%]=Louise
does this mean that I would have to type in 210 different variables manually.
this example in the help file really didnt tell me anything about arrays whatsoever.
I know how to get pixel from each location
//Get pixel colorS
//x and y coords are where the search will begin
Let>x=0
Let>y=0
Let>xcount=15
Let>ycount=14
Label>Loop
GetPixelColor>x,y,HOW DO I SIGN THIS VALUE TO A BUNCH OF DIFFERENT VARIABLES
If>%x%NextColumn
Let>x=%x%+1
Goto>Loop
Label>NextRow
If>%y%=%ycount%,END
Let>y=%y%+1
Let>x=0
Goto>Loop
Label>END
how do i save the file to text?
how do i make arrays?
I got it!
wait>5
//Get pixel color and save to text file
//x and y coords are where the search will begin
Let>x=635
Let>y=528
Let>xcount=%x%+14
Let>ycount=%y%+13
Let>count=0
Let>VAREXPLICIT=0
Let>k=0
Label>Loop
Let>k=%k%+1
GetPixelColor>x,y,color
add>count,1
Let>var_%k%=%color%
WriteLn>c:\varexplicit_test.txt,wresult,var_%k%
If>%x%NextColumn
add>x,1
goto>Loop
Label>NextRow
If>%y%>%ycount%
goto>PRINT
ELSE
add>y,1
Let>x=635
endif
If>count=210
goto>PRINT
EndIF
goto>Loop
Label>PRINT
Run>Notepad.exe c:\varexplicit_test.txt
wait>5
//Get pixel color and save to text file
//x and y coords are where the search will begin
Let>x=635
Let>y=528
Let>xcount=%x%+14
Let>ycount=%y%+13
Let>count=0
Let>VAREXPLICIT=0
Let>k=0
Label>Loop
Let>k=%k%+1
GetPixelColor>x,y,color
add>count,1
Let>var_%k%=%color%
WriteLn>c:\varexplicit_test.txt,wresult,var_%k%
If>%x%NextColumn
add>x,1
goto>Loop
Label>NextRow
If>%y%>%ycount%
goto>PRINT
ELSE
add>y,1
Let>x=635
endif
If>count=210
goto>PRINT
EndIF
goto>Loop
Label>PRINT
Run>Notepad.exe c:\varexplicit_test.txt
- Marcus Tettmar
- Site Admin
- Posts: 7395
- Joined: Thu Sep 19, 2002 3:00 pm
- Location: Dorset, UK
- Contact:
Hi,
I was thinking of something like this:
Let>Colors[0,0]=
Let>XStart=10
Let>XStop=30
Let>YStart=10
Let>YStop=30
Let>x=XStart
Repeat>x
Let>y=YStart
Repeat>y
GetPixelColor>x,y,color
Let>Colors[%x%,%y%]=color
Let>y=y+1
Until>y>YStop
Let>x=x+1
Until>x>XStop
Note the multi-dimensional array. Once the operation is complete, say you want to get the color at position 16,28 you would just do:
Let>color=Colors[16,28]
Note also the use of nested Repeat/Until loops which simplify the code considerably.
I was thinking of something like this:
Let>Colors[0,0]=
Let>XStart=10
Let>XStop=30
Let>YStart=10
Let>YStop=30
Let>x=XStart
Repeat>x
Let>y=YStart
Repeat>y
GetPixelColor>x,y,color
Let>Colors[%x%,%y%]=color
Let>y=y+1
Until>y>YStop
Let>x=x+1
Until>x>XStop
Note the multi-dimensional array. Once the operation is complete, say you want to get the color at position 16,28 you would just do:
Let>color=Colors[16,28]
Note also the use of nested Repeat/Until loops which simplify the code considerably.
Marcus Tettmar
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?
http://mjtnet.com/blog/ | http://twitter.com/marcustettmar
Did you know we are now offering affordable monthly subscriptions for Macro Scheduler Standard?