Jump to content

Recommended Posts

Posted

This afternoon my internet broke so I made a really random script to pass the time.

All it does is search the pixels on your desktop and tells you how many of them are the color you picked.

#include <GUIConstants.au3>

$Gui = GUICreate("Pixel Color Count", 200, 200, 193, 115)
$Label1 = GUICtrlCreateLabel("Target Color: ", 8, 16, 180, 17)
$Label2 = GUICtrlCreateLabel("Color: ", 8, 40, 180, 17)
$Label3 = GUICtrlCreateLabel("Progress: ", 8, 64, 180, 17)
$Label4 = GUICtrlCreateLabel("Total: ", 8, 88, 180, 17)
$Input1 = GUICtrlCreateInput("Color in Hex", 32, 128, 121, 21)
$Button1 = GUICtrlCreateButton("Start", 56, 160, 75, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $GUI_EVENT_CLOSE
            Exit
        Case $Msg = $Button1
            $targetcolor = GUICtrlRead($Input1)
            $total = 0
            For $w = @DesktopWidth to 0 Step -1
                For $h = @DesktopHeight to 0 Step -1
                    $Msg = GUIGetMsg()
                    $color = PixelGetColor($w, $h)
                    $Hcolor = hex($color, 6)
                    GUICtrlSetData($Label1, "Target Color: " & $targetcolor) 
                    GUICtrlSetData($Label2, "Color: " & $Hcolor)
                    GUICtrlSetData($Label3, "Progress: " & $w & $h)
                    GUICtrlSetData($Label4, "Total: " & $total)
                    Select
                        Case $Hcolor = $targetcolor
                            $total = $total + 1
                        Case $Msg = $GUI_EVENT_CLOSE
                            Exit
                    EndSelect
                Next
            Next
            MsgBox(0, "Total " & $targetcolor & " Pixels", $total)
    EndSelect
WEnd

[size="1"]Please stop confusing "how to" with "how do"[/size]

Posted

This afternoon my internet broke so I made a really random script to pass the time.

All it does is search the pixels on your desktop and tells you how many of them are the color you picked.

#include <GUIConstants.au3>

$Gui = GUICreate("Pixel Color Count", 200, 200, 193, 115)
$Label1 = GUICtrlCreateLabel("Target Color: ", 8, 16, 180, 17)
$Label2 = GUICtrlCreateLabel("Color: ", 8, 40, 180, 17)
$Label3 = GUICtrlCreateLabel("Progress: ", 8, 64, 180, 17)
$Label4 = GUICtrlCreateLabel("Total: ", 8, 88, 180, 17)
$Input1 = GUICtrlCreateInput("Color in Hex", 32, 128, 121, 21)
$Button1 = GUICtrlCreateButton("Start", 56, 160, 75, 25, 0)
GUISetState(@SW_SHOW)

While 1
    $Msg = GUIGetMsg()
    Select
        Case $Msg = $GUI_EVENT_CLOSE
            Exit
        Case $Msg = $Button1
            $targetcolor = GUICtrlRead($Input1)
            $total = 0
            For $w = @DesktopWidth to 0 Step -1
                For $h = @DesktopHeight to 0 Step -1
                    $Msg = GUIGetMsg()
                    $color = PixelGetColor($w, $h)
                    $Hcolor = hex($color, 6)
                    GUICtrlSetData($Label1, "Target Color: " & $targetcolor) 
                    GUICtrlSetData($Label2, "Color: " & $Hcolor)
                    GUICtrlSetData($Label3, "Progress: " & $w & $h)
                    GUICtrlSetData($Label4, "Total: " & $total)
                    Select
                        Case $Hcolor = $targetcolor
                            $total = $total + 1
                        Case $Msg = $GUI_EVENT_CLOSE
                            Exit
                    EndSelect
                Next
            Next
            MsgBox(0, "Total " & $targetcolor & " Pixels", $total)
    EndSelect
WEnd
Rofl!

Thats pretty cool :rolleyes:

Nice I'll use this when my internet brokes

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
  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...