FadetoGrey Posted May 9, 2009 Author Posted May 9, 2009 (edited) No $File = FileOpen("test.txt", 1);Or any other name.txt For $i = 59 to 400 step 1;Change 400 to the end X coordinates For $j = 51 to 100 step 1;Change 100 to the end Y coordinates $I_Found_This_Pixel = PixelGetColor( $i, $j ) FileWrite ( $file, " " & $i & "," & $j & " is " & $I_Found_This_Pixel ) Next Next $File = FileOpen("test.txt", 1);Or any other name.txt For $i = 59 to 459 step 1;Asuming the picture is 500 pixels wide and high For $j = 424 to 51 step 1;Change height and width if needed $I_Found_This_Pixel = PixelGetColor( $i, $j ) FileWrite ( $file, " " & $i & "," & $j & " is " & $I_Found_This_Pixel ) Next Next I tried running that but nothing happens. Are the coords correct? I want it to gather all the pixel colours from 59,51 to 424,459. And about the .txt file, do I need to have one already made with the name test.txt? Edited May 9, 2009 by FadetoGrey
Qousio Posted May 9, 2009 Posted May 9, 2009 $File = FileOpen("test.txt", 1);Or any other name.txt For $i = 59 to 459 step 1;Asuming the picture is 500 pixels wide and high For $j = 424 to 51 step 1;Change height and width if needed $I_Found_This_Pixel = PixelGetColor( $i, $j ) FileWrite ( $file, " " & $i & "," & $j & " is " & $I_Found_This_Pixel ) Next Next I tried running that but nothing happens. Are the coords correct? I want it to gather all the pixel colours from 59,51 to 424,459. And about the .txt file, do I need to have one already made with the name test.txt? This should work: $File = FileOpen("test.txt", 1);Or any other name.txt For $i = 59 to 459 step 1;Asuming the picture is 500 pixels wide and high For $j = 51 to 424 step 1;Change height and width if needed $I_Found_This_Pixel = PixelGetColor( $i, $j ) FileWrite ( $file, " " & $i & "," & $j & " is " & $I_Found_This_Pixel ) Next Next No, it will create the file when you launch your script.
FadetoGrey Posted May 9, 2009 Author Posted May 9, 2009 This should work: $File = FileOpen("test.txt", 1);Or any other name.txt For $i = 59 to 459 step 1;Asuming the picture is 500 pixels wide and high For $j = 51 to 424 step 1;Change height and width if needed $I_Found_This_Pixel = PixelGetColor( $i, $j ) FileWrite ( $file, " " & $i & "," & $j & " is " & $I_Found_This_Pixel ) Next Next No, it will create the file when you launch your script. Yes that worked perfectly. Only thing is, is can it just make a list of the pixel colour vertically, because it's giving me 59,51 is 8421504 59,52 is 8421504 59,53 is 8421504 59,54 is 8421504 59,55 is 8421504 all the way across the page, then when it's at the end of the line it starts a new line. If it could put it in a big list that would work better, and also, could you make it so it doesn't say pixel number is pixel colour, just make iot state the pixel colour. Thanks.
Qousio Posted May 9, 2009 Posted May 9, 2009 Yes that worked perfectly. Only thing is, is can it just make a list of the pixel colour vertically, because it's giving me 59,51 is 8421504 59,52 is 8421504 59,53 is 8421504 59,54 is 8421504 59,55 is 8421504 all the way across the page, then when it's at the end of the line it starts a new line. If it could put it in a big list that would work better, and also, could you make it so it doesn't say pixel number is pixel colour, just make iot state the pixel colour. Thanks. $File = FileOpen("test.txt", 1);Or any other name.txt For $i = 59 to 459 step 1;Asuming the picture is 500 pixels wide and high For $j = 51 to 424 step 1;Change height and width if needed $I_Found_This_Pixel = PixelGetColor( $i, $j ) FileWrite ( $file, $I_Found_This_Pixel & @CRLF ) Next Next
FadetoGrey Posted May 9, 2009 Author Posted May 9, 2009 $File = FileOpen("test.txt", 1);Or any other name.txt For $i = 59 to 459 step 1;Asuming the picture is 500 pixels wide and high For $j = 51 to 424 step 1;Change height and width if needed $I_Found_This_Pixel = PixelGetColor( $i, $j ) FileWrite ( $file, $I_Found_This_Pixel & @CRLF ) Next Next Awesome, I also need it to delete any duplicates in the file, so any pixel colours that are the same it will delete, but leave one ofcourse.
Qousio Posted May 9, 2009 Posted May 9, 2009 Awesome, I also need it to delete any duplicates in the file, so any pixel colours that are the same it will delete, but leave one ofcourse.I'm not sure how to do this with the Autoit language, but I guess using Strings and/or _FileReadToArray is the way to go. You will have to wait till somebody familiar with strings checks your thread.
FadetoGrey Posted May 9, 2009 Author Posted May 9, 2009 I'm not sure how to do this with the Autoit language, but I guess using Strings and/or _FileReadToArray is the way to go. You will have to wait till somebody familiar with strings checks your thread.No problem man, thanks for all your help, appreciate it.
Qousio Posted May 9, 2009 Posted May 9, 2009 No problem man, thanks for all your help, appreciate it. This should do the trick: #Include <File.au3> #Include <Array.au3> Dim $A $File = FileOpen("Test.txt", 1);Or any other name.txt For $i = 59 to 459 step 1 For $j = 51 to 424 step 1 $I_Found_This_Pixel = PixelGetColor( $i, $j ) FileWrite ( $file, $I_Found_This_Pixel & @CRLF ) Next Next Sort() Func Sort() _FileReadToArray(@ScriptDir & "\Test.txt", $A) $A = _ArrayUnique($A) _FileWriteFromArray(@ScriptDir & "\Sorted.txt", $A, 1) EndFunc
FadetoGrey Posted May 9, 2009 Author Posted May 9, 2009 This should do the trick: #Include <File.au3> #Include <Array.au3> Dim $A $File = FileOpen("Test.txt", 1);Or any other name.txt For $i = 59 to 459 step 1 For $j = 51 to 424 step 1 $I_Found_This_Pixel = PixelGetColor( $i, $j ) FileWrite ( $file, $I_Found_This_Pixel & @CRLF ) Next Next Sort() Func Sort() _FileReadToArray(@ScriptDir & "\Test.txt", $A) $A = _ArrayUnique($A) _FileWriteFromArray(@ScriptDir & "\Sorted.txt", $A, 1) EndFunc Great thanks, but for some reason it makes the test.txt and puts all the pixels in, but then it just sits there and does nothing. Does it take some time before it's finished it's job.. or is something wrong with it?
Qousio Posted May 10, 2009 Posted May 10, 2009 Great thanks, but for some reason it makes the test.txt and puts all the pixels in, but then it just sits there and does nothing. Does it take some time before it's finished it's job.. or is something wrong with it?First of all, you need the Sorted.txt already created.Secondly it takes some time.I have tested it with about 30 lines of text and it worked fine.
FadetoGrey Posted May 10, 2009 Author Posted May 10, 2009 First of all, you need the Sorted.txt already created.Secondly it takes some time.I have tested it with about 30 lines of text and it worked fine.It's still doing the same thing. I've created a blank .txt file called Sorted.txt like you said, but it just sits there and it doesn't even write one line on the Sorted.txt file.
Qousio Posted May 10, 2009 Posted May 10, 2009 It's still doing the same thing. I've created a blank .txt file called Sorted.txt like you said, but it just sits there and it doesn't even write one line on the Sorted.txt file. Try putting this: expandcollapse popup1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 22 22 22 33 44 55 66 77 77 77 77 77 77 1 2 3 4 5 6 7 8 9 Into test.txt Then run this #Include <File.au3> #Include <Array.au3> Dim $A Sort() Func Sort() _FileReadToArray(@ScriptDir & "\Test.txt", $A) $A = _ArrayUnique($A) _FileWriteFromArray(@ScriptDir & "\Sorted.txt", $A, 1) EndFunc If sorted.txt will have only unique numbers, then the script works, but your computer will take allot of time to process the colour data.
FadetoGrey Posted May 10, 2009 Author Posted May 10, 2009 Try putting this: expandcollapse popup1 2 3 4 5 6 7 8 9 1 2 3 4 5 6 7 8 9 22 22 22 33 44 55 66 77 77 77 77 77 77 1 2 3 4 5 6 7 8 9 Into test.txt Then run this #Include <File.au3> #Include <Array.au3> Dim $A Sort() Func Sort() _FileReadToArray(@ScriptDir & "\Test.txt", $A) $A = _ArrayUnique($A) _FileWriteFromArray(@ScriptDir & "\Sorted.txt", $A, 1) EndFunc If sorted.txt will have only unique numbers, then the script works, but your computer will take allot of time to process the colour data. Doesn't the script create test.txt? Do I make test.txt then put in those numbers? Or after I've run the script once, put it above all the pixel colours, or what?
Qousio Posted May 10, 2009 Posted May 10, 2009 Doesn't the script create test.txt? Do I make test.txt then put in those numbers? Or after I've run the script once, put it above all the pixel colours, or what?Just create a blank Test.txt in the same directory your script is. And put those numbers there.
FadetoGrey Posted May 10, 2009 Author Posted May 10, 2009 Just create a blank Test.txt in the same directory your script is. And put those numbers there.Still nothing
Developers Jos Posted May 10, 2009 Developers Posted May 10, 2009 Still nothing Wondering when you stop ignoring me and start doing some work with debugging/testing yourself? SciTE4AutoIt3 Full installer Download page  - Beta files    Read before posting   How to post scriptsource   Forum etiquette Forum Rules  Live for the present, Dream of the future, Learn from the past.Â
RAMMRODD Posted May 10, 2009 Posted May 10, 2009 (edited) I used the script you posted Qousio, and I get the long decimals. But now how do I translate that into an actual color? I got numbers like 16777215, which isnt hex or Decimal (that I could find with Google) the numbers seem to long. Did I mess up or is there a prerequisite before they can be used as a common hex or decimal color? BTW Thanks for the script I've been wondering how to do this for a while. So I appreciate your work. Chad EDIT: was looking at another post Qousio is involved in and saw numbers very similar to mine, so off to google I go searching for a translation. Edited May 10, 2009 by RAMMRODD
Qousio Posted May 10, 2009 Posted May 10, 2009 I used the script you posted Qousio, and I get the long decimals. But now how do I translate that into an actual color? I got numbers like 16777215, which isnt hex or Decimal (that I could find with Google) the numbers seem to long. Did I mess up or is there a prerequisite before they can be used as a common hex or decimal color?BTW Thanks for the script I've been wondering how to do this for a while. So I appreciate your work.ChadEDIT: was looking at another post Qousio is involved in and saw numbers very similar to mine, so off to google I go searching for a translation.Hmm, you can convert Decimal to Hex with Hex ( expression )Don't forget to use "0x" with hex, such as 0xNumbers when using hex.
RAMMRODD Posted May 10, 2009 Posted May 10, 2009 so, 16777215 is actually a decimal right? The converters online seem to cut off the last few numbers or say that the numbers have to be 255 or less. Am I trying to convert it incorrectly?
FadetoGrey Posted May 10, 2009 Author Posted May 10, 2009 I used the script you posted Qousio, and I get the long decimals. But now how do I translate that into an actual color? I got numbers like 16777215, which isnt hex or Decimal (that I could find with Google) the numbers seem to long. Did I mess up or is there a prerequisite before they can be used as a common hex or decimal color?BTW Thanks for the script I've been wondering how to do this for a while. So I appreciate your work.ChadEDIT: was looking at another post Qousio is involved in and saw numbers very similar to mine, so off to google I go searching for a translation.Which code did you use? The latest one? How did you get it to work? Doesn't work for me.
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