Jump to content

Recommended Posts

Posted

I have been busy elsewhere and today I dusted off AutoIt and decided to try something.

This script will identify a color under the mouse and reply in human terms.

I set the values to return on a scale of 0 to 10 and then using my best judgement I named the color.

It could use some tweaks but it works.

While 1
    $pos = MouseGetPos()
    $ax = $pos[0] 
    $ay = $pos[1]   
    $var = PixelGetColor( $ax , $ay )
    $color = Hex($var,6)
    $Redcv = Int(Dec(StringLeft ($color,2))/25.5)
    $Blucv = Int(Dec(StringRight ($color,2))/25.5)
    $Grncv = Int(Dec(StringMid ($color,3,2))/25.5)
    
    $cvalue = Get_Color ($Redcv,$Grncv,$Blucv)
    
    ToolTip ($cvalue)
    Sleep (50)
WEnd

Func Get_Color ($rv,$gv,$bv)
$gc = "unknown"
If $rv = $gv and $bv = $gv Then $gc = "Gray"
If $rv > 8 and $gv > 8 and $bv > 8 Then $gc = "White"
If $rv < 2 and $gv < 2 and $bv < 2 Then $gc = "Black"
    
If $rv > $bv And $rv > $gv Then 
    $gc = "Red"
    If $bv < 2 Then
        If $gv > 3 Then $gc = "Brown"
        If $gv > 5 Then $gc = "Orange"
        If $gv > 7 Then $gc = "Yellow"
    EndIf
    If $gv < 2 Then
        If $bv > 3 Then $gc = "Rust"
        If $bv > 5 Then $gc = "Pink"
        If $bv > 7 Then $gc = "Hot Pink"
    EndIf
EndIf
If $gv > $bv And $gv > $rv Then 
    $gc = "Green"
    If $bv < 2 Then
        If $rv > 3 Then $gc = "Lt. Green"
        If $rv > 5 Then $gc = "Lime"
        If $rv > 7 Then $gc = "Yellow"
    EndIf
    If $rv < 2 Then
        If $bv > 3 Then $gc = "Lt. Green"
        If $bv > 5 Then $gc = "Turquoise"
        If $bv > 7 Then $gc = "Cyan"
    EndIf
EndIf
If $bv > $rv And $bv > $gv Then 
    $gc = "Blue"
    If $rv < 2 Then
        If $gv > 3 Then $gc = "Sea Blue"
        If $gv > 5 Then $gc = "Sky Blue"
        If $gv > 7 Then $gc = "Cyan"
    EndIf
    If $gv < 2 Then
        If $rv > 3 Then $gc = "Violet"
        If $rv > 5 Then $gc = "Purple"
        If $rv > 7 Then $gc = "Hot Pink"
    EndIf
EndIf

Return $gc
EndFunc

Please note: The last time I posted here was over 2 years ago because some moron got me ticked off.  I write programs and scripts for a living and I am not some child sitting in mom's dungeon hacking interweb games. All I ask for is a little respect and I will return the same.

Have a better one.

  • Moderators
Posted

jabhacksoul,

I see you hold a grudge really well - I hope it did not keep you awake at night! :D

From this thread:

All I ask for is a little respect

And from your last thread:

The people on this forum are freaking brain dead

Do you not think that you could have started your new tenure here in a better way by acting in the very manner you demand from us rather than being as aggressive as you were? :huh:

Anyway, with an attitude like that I wonder how long you will last this time around..... :whistle:

M23

Public_Domain.png.2d871819fcb9957cf44f4514551a2935.png Any of my own code posted anywhere on the forum is available for use by others without any restriction of any kind

Open spoiler to see my UDFs:

Spoiler

ArrayMultiColSort ---- Sort arrays on multiple columns
ChooseFileFolder ---- Single and multiple selections from specified path treeview listing
Date_Time_Convert -- Easily convert date/time formats, including the language used
ExtMsgBox --------- A highly customisable replacement for MsgBox
GUIExtender -------- Extend and retract multiple sections within a GUI
GUIFrame ---------- Subdivide GUIs into many adjustable frames
GUIListViewEx ------- Insert, delete, move, drag, sort, edit and colour ListView items
GUITreeViewEx ------ Check/clear parent and child checkboxes in a TreeView
Marquee ----------- Scrolling tickertape GUIs
NoFocusLines ------- Remove the dotted focus lines from buttons, sliders, radios and checkboxes
Notify ------------- Small notifications on the edge of the display
Scrollbars ----------Automatically sized scrollbars with a single command
StringSize ---------- Automatically size controls to fit text
Toast -------------- Small GUIs which pop out of the notification area

 

  • Developers
Posted

Please note: The last time I posted here was over 2 years ago because some moron got me ticked off.  I write programs and scripts for a living and I am not some child sitting in mom's dungeon hacking interweb games. All I ask for is a little respect and I will return the same.

Have a better one.

Welcome back for the 3rd time.

Funny to see your still haven't lost the attitude you first shown when you were here as Kahn... 

Enjoy your stay here,

Jos

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.
  :)

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
×
×
  • Create New...