Jump to content

pointless6

Registered User
  • Posts

    5
  • Joined

  • Last visited

About pointless6

  • Birthday 10/03/1990

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

pointless6's Achievements

Curious Beginner

Curious Beginner (1/7)

10

Reputation

  1. After a short break and returning with fresh eyes I think I'm finally there. If anyone is interested in this feel free to let me know.
  2. import wmi import binascii c = wmi.WMI(namespace="root\WMI") clevo = "select * from CLEVO_GET" while True: def get_pixel_colour(i_x, i_y): import win32gui i_desktop_window_id = win32gui.GetDesktopWindow() i_desktop_window_dc = win32gui.GetWindowDC(i_desktop_window_id) long_colour = win32gui.GetPixel(i_desktop_window_dc, i_x, i_y) i_colour = int(long_colour) return (i_colour & 0xff), ((i_colour >> 8) & 0xff), ((i_colour >> 16) & 0xff) #print get_pixel_colour(0, 0) data = ''.join(map(chr, get_pixel_colour(0, 0))).encode('hex') data2 = ''.join(map(chr, get_pixel_colour(500, 500))).encode('hex') data3 = ''.join(map(chr, get_pixel_colour(1024, 768))).encode('hex') ark = int("F0"+data,16) ark2 = int("F1"+data2,16) ark3 = int("F2"+data3,16) #ark4 = int("F1"+data4,16) for doy in c.query(clevo): doy.SetKBLED(ark) doy.SetKBLED(ark2) doy.SetKBLED(ark3) Getting there! This works independently without the need to capture data from milight but it's just three single pixels and yet to have a decent colour averaging algorithm. Any help would be appriciated
  3. I'm now changing keyboard colours with python! You'll need python 2.7, pywin32 and WMI import wmi c = wmi.WMI(namespace="root\WMI") clevo = "select * from CLEVO_GET" myhex = "00FF00"; left_color = int("F0"+myhex, 16) mid_color = int("F1"+myhex, 16) right_color = int("F2"+myhex, 16) for doy in c.query(clevo): #print color doy.SetKBLED(right_color) I can also create sockets and capture the udp packets from MiLight Controller: Download: epocapp.bitbucket.org/milight/ Set Number of Colours - 4 Colors (2 Controllers) Then Options > Settings Create 4 local i.p addresses, (all 127.0.0.1) with port numbers 5005,5006,5007,5008 Colours.py import socket import binascii import wmi import struct c = wmi.WMI(namespace="root\WMI") clevo = "select * from CLEVO_GET" UDP_IP = "127.0.0.1" UDP_PORT = 5005 UDP_PORT2 = 5006 UDP_PORT3 = 5007 UDP_PORT4 = 5008 sock = socket.socket(socket.AF_INET, # Internet socket.SOCK_DGRAM) # UDP sock.bind((UDP_IP, UDP_PORT)) sock2 = socket.socket(socket.AF_INET, # Internet socket.SOCK_DGRAM) # UDP sock2.bind((UDP_IP, UDP_PORT2)) sock3 = socket.socket(socket.AF_INET, # Internet socket.SOCK_DGRAM) # UDP sock3.bind((UDP_IP, UDP_PORT3)) sock4 = socket.socket(socket.AF_INET, # Internet socket.SOCK_DGRAM) # UDP sock4.bind((UDP_IP, UDP_PORT4)) while True: data, addr = sock.recvfrom(1024) data2, addr2 = sock2.recvfrom(1024) data3, addr3 = sock3.recvfrom(1024) data4, addr3 = sock4.recvfrom(1024) ark = int("F0"+binascii.hexlify(data),16) ark2 = int("F1"+binascii.hexlify(data2),16) ark3 = int("F1"+binascii.hexlify(data3),16) ark4 = int("F2"+binascii.hexlify(data4),16) for doy in c.query(clevo): doy.SetKBLED(ark) doy.SetKBLED(ark2) doy.SetKBLED(ark4) print "packet",data,"| hex",ark Your keyboard should be changing colours! This is where I'm currently stuck. In the terminal, the data you will see is udp packets converted straight to hex but I'm unsure this is correct.. ..you can see the packets are 3 characters long and I have no idea what the encoding is, so we won't get the proper hex values until this is fixed. Could anyone shed any light on this?
  4. Hello! I'm using a Clevo P771DM-G and really want to get adaptive keyboard working! Trying my best but only have experience building for web. You may have already seen this: https://code.google.com/p/baggett-scripts/source/browse/trunk/set-kbled.ps1 Seems they are selecting clevo table from wmi database? Which works, and I'm wondering if this is less driver/version specific than yours? get-wmiobject -query "select * from CLEVO_GET" -namespace "root\WMI" Code is currently set up with hard-coded colour array but would take any hex value with a tweak. Then it's just a case of getting average hex pixel value and parsing it through this code. It offers Left, Middle and Right so maybe three positional pixel monitors? I know that your milight software kind of already does this and was even thinking of creating ip addresses with listeners for those led bulb values but it seems a long way round. After building your source and poking around I can't see any pixel monitoring and the lightfx library is commented out. I would like to avoid lightfx if possible, that is if I'm right in saying it won't be compatible with everything? I'll keep trying but I hope you can find some time to help!
  5. Hey, I'm using Clevo P771DM and quite excited by the ps script, it's the first time I've been able to control my clevo keyboard lights! Would you know how I would go about modifying that color array to accept a hex or rgb string without hardcoding all of the colours? So we could do SET-KBLED -StringColor "FF0000" //in params [ValidateSet(<HERE?>)][string]$StringColor, .... if ($StringColor -NE "" ) { $col0 = [Convert]::ToUInt32("F0" +$myhex[$this], 16) $col1 = [Convert]::ToUInt32("F1" +$myhex[$this], 16) $col2 = [Convert]::ToUInt32("F2" +$myhex[$this], 16) $clevo.SetKBLED( $col0 ) $clevo.SetKBLED( $col1 ) $clevo.SetKBLED( $col2 ) } Dev has released http://epocapp.bitbucket.org/milight/ Maybe we can trick this software to parse the screen colour values to the script? I've rebuilt "Backlight Controller with LightFX" to v0.0.6.1 and it now runs on windows 10 but doesn't affect the lights, any help here would be greatly appreciated, I don't know ps or cs just doing my best to figure this out. I think it would be best to avoid the alienfx api if we can so all games are compatible.
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.