System.PixelColor
It just won't work for me :(
Sunday, February 22, 2009 by vAIp33r | Discussion: DesktopX
I've been looking into System.PixelColor option and I just can't make it work correctly.
This is the script I'm using:
- hexcolor = Hex(System.PixelColor(System.CursorX, System.CursorY))
- red = Right(hexcolor, 2)
- green = Mid(hexcolor, 2,2)
- blue = Left(hexcolor, 2)
- 'I added these Ifs because sometimes red, green or blue return "" and that doesn't really work
- If red="" Then
- red=0
- End If
- If green="" Then
- green=0
- End If
- If blue="" Then
- blue=0
- End If
- DesktopX.Object("-1/-1").TextColor = RGB(CLng("&H" & red),CLng("&H" & green),CLng("&H" & blue))
(it is basically just a bit retouched rudamentary script from https://www.stardock.com/products/desktopx/documentation/scripting/system_namespace.asp)
It's on a timer so it loops and it actually changes number values but they are not correct. If anyone has any idea why this won't work please, don't be shy ![]()
Reply #2 Sunday, February 22, 2009 1:35 PM
this was the script in the "color picker" widget that comes with DX (or did)
- x = System.CursorX
- y = System.CursorY
- color = System.PixelColor(x, y)
- hexcolor = Hex(color)
- red = Right(hexcolor, 2)
- green = Right(left(hexcolor, 4), 2)
- blue = Left(hexcolor, 2)
- Object.Text = CStr(CLng("&H" & red)) & ", " & CStr(CLng("&H" & green)) & ", " & CStr(CLng("&H" & blue))
- DesktopX.Object("dx_color_sample").TextColor = RGB(CLng("&H" & red),CLng("&H" & green),CLng("&H" & blue))
In the above example the name of the object is "dx_color_sample"
---
Im curious how this is working:
- DesktopX. Object (" -1/-1 ").TextColor
the "-1/-1" SHOULD be the NAME of the object you want to change the text color of, did you name the object -1/-1?
Reply #3 Sunday, February 22, 2009 4:04 PM
Yeah I named it -1/-1 since I'll be using a multitude of little objects and I decided to name them after their relative coordinates.
Just C/P your example and it works like it should THANKS A BUNCH!
10 internets to you, ehm I mean +1 karma ![]()
I didn't know that works too, unfortunately I need R G and B values separated. Thanks for your reply tho ![]()
Please login to comment and/or vote for this skin.
Welcome Guest! Please take the time to register with us.
There are many great features available to you once you register, including:
- Richer content, access to many features that are disabled for guests like commenting on the forums and downloading skins.
- Access to a great community, with a massive database of many, many areas of interest.
- Access to contests & subscription offers like exclusive emails.
- It's simple, and FREE!







Reply #1 Sunday, February 22, 2009 1:16 PM
Hi, you don't need to convert it to and from hex, just using
works fine
Unless you're trying to do something else I'm not aware of.