Sign in to follow this  
Followers 0
CodeMaster Rapture

Having a wierd problem with HTML Logs

4 posts in this topic

Greetings,

I'm trying to log all the colors in a small area of the screen and then output it to an HTML file so that shows the color. I know HTML Hex is in RGB format, but it won't show the colors properly (I.E. Some lines show black, even though the color isn't black). The code I've got is this:

HotKeySet("+{ESC}","Quit")
HotKeySet("+{F1}","Pause")

#region Globals:
Global $Pause       = 1 ;True == 1, False == -1
Global $LogFile     = ""
Global $hFileOpen   = -1
#endregion

Update_LogFile()
    
While 1
    If ($Pause == -1 And WinActive("World of Warcraft")) Then
        For $X = 536 to 547 Step 1
            For $Y = 742 to 752 Step 1
                $Color = Hex(PixelGetColor($X,$Y),6)
                FileWriteLine($hFileOpen,'Color at ' & $X & ', ' & $Y & ' is <FONT COLOR="#' & $Color & '">0x' & $Color & '</FONT><BR>')
            Next
        Next
        Close_LogFile()
        Update_LogFile()
        Pause()
        Sleep(10)
    EndIf
    Sleep(10)
WEnd

#region Log Functions:
Func Update_LogFile()
    For $loop = 0 to 9999 Step 1
        If Not (FileExists(@ScriptDir & "\Log." & $loop & ".html")) Then
            $LogFile = @ScriptDir & "\Log." & $loop & ".html"
            ExitLoop
        EndIf
    Next
    
    $hFileOpen = FileOpen($LogFile,1)
    If ($hFileOpen == -1) Then
        MsgBox(0,"Error","Could not open logfile!")
        Exit
    EndIf
    FileWriteLine($hFileOpen,"<HTML>" & @CRLF & "<HEAD><TITLE>Color Log</TITLE></HEAD>")
    FileWriteLine($hFileOpen,'<BODY BGCOLOR="#999999">')
EndFunc

Func Close_LogFile()
    FileWriteLine($hFileOpen,"</BODY>" & @CRLF & "</HTML>")
    FileClose($hFileOpen)
EndFunc
#endregion

Func Quit()
    Close_LogFile()
    Exit
EndFunc

Func Pause()
    $Pause *= -1
EndFunc

And the output is:

<HTML>
<HEAD><TITLE>Color Log</TITLE></HEAD>
<BODY BGCOLOR="#999999">
Color at 536, 742 is <FONT COLOR="#49463F">0x49463F</FONT><BR>
Color at 536, 743 is <FONT COLOR="#2A2821">0x2A2821</FONT><BR>


;Skipping a bunch of lines that are correct


Color at 547, 751 is <FONT COLOR="#43433A">0x43433A</FONT><BR>
Color at 547, 752 is <FONT COLOR="#686560">0x686560</FONT><BR>
</BODY>
</HTML>

Now if I open the HTML file, only the colors with a hex value greater than 0x600000 are colored. Everything else is black. Am I doing something wrong?

Thanx,

-CMR

Share this post


Link to post
Share on other sites



#2 ·  Posted (edited)

Hi!

I know from my HTML editors that some colors are not "web save". This means that some browser can (or want) only display e.g. 65536 colors. I think that Firefox (www.mozilla.org) displays them all. Would be worth a test with this browser. The HTML code itself looks correct to me.

peethebee

Edited by peethebee

vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Share this post


Link to post
Share on other sites

#3 ·  Posted (edited)

I'll give it a shot, thanx.

Edit: Nope, still doesn't work. Guess I'll just write a BMP machine for MS Paint.

Edited by CodeMaster Rapture

Share this post


Link to post
Share on other sites

Hi again!

Perhaps you check the HTML source with the validator of www.w3c.org to make sure that the source is correct.

peethebee


vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvGerman Forums: http://www.autoit.deGerman Help File: http://autoit.de/hilfe vvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvvv

Share this post


Link to post
Share on other sites

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 account

Sign in

Already have an account? Sign in here.


Sign In Now
Sign in to follow this  
Followers 0