Change screen brightness using mouse wheel
Hello there, just bought this excellent software.
I really like the volume control using mouse wheel option, on right edge of screen, and thought, why not an option to change screen brightness at the left edge of the screen, using the mouse wheel as well? I often change my screen birghtness depending on the time of the day, and the room's lightining, and this would help a lot.
Any way to do this using a command or something?
Thanks in advance.
I really like the volume control using mouse wheel option, on right edge of screen, and thought, why not an option to change screen brightness at the left edge of the screen, using the mouse wheel as well? I often change my screen birghtness depending on the time of the day, and the room's lightining, and this would help a lot.
Any way to do this using a command or something?
Thanks in advance.
Great idea, thanks, I'm sure it is possible. I'll take a look.
The easiest would be just to use the command below (found a function on Autohotkey forum). You can put it in the start menu, define shortcuts etc. for your favorite brightness levels. Change the first line to required brightness level.
I may prepare more elaborate commands when I get time.
Code: Select all
br:=60 ;Brightness: 0=Darkest, 255=Brightest, 128 Normal
VarSetCapacity(gr, 512*3)
Loop, 256
{
If (nValue:=(br+128)*(A_Index-1))>65535
nValue:=65535
NumPut(nValue, gr, 2*(A_Index-1), "Ushort")
NumPut(nValue, gr, 512+2*(A_Index-1), "Ushort")
NumPut(nValue, gr, 1024+2*(A_Index-1), "Ushort")
}
hDC := DllCall("GetDC", "Uint", 0)
DllCall("SetDeviceGammaRamp", "Uint", hDC, "Uint", &gr)
DllCall("ReleaseDC", "Uint", 0, "Uint", hDC)
Thank you! Added it to Start Menu. Seems like it doesn't exactly use Windows brightness controls, but it works!
Still, a feature like the current volume control with mouse wheel would be the best, if that's possible.
Thanks again.
Still, a feature like the current volume control with mouse wheel would be the best, if that's possible.
Thanks again.
Here are the updated scripts:
1. Change screen brightness up/down
Shortcut: ^WheelUp (up - set First line to V=3)
Shortcut: ^WheelDown (down - set first line to V=-3)
Type: Command
2. Set Screen Brightness
Shortcut: Alt-X
Type: Command
Set first line to Br:=brightness level between 0 and 255: 0=Darkest, 255=Brightest, 128 Normal
1. Change screen brightness up/down
Shortcut: ^WheelUp (up - set First line to V=3)
Shortcut: ^WheelDown (down - set first line to V=-3)
Type: Command
Code: Select all
V:=3 ;positive-step up, negative-step down
#MaxHotkeysPerInterval 10000
VarSetCapacity(GR,1536,0)
DllCall("GetDeviceGammaRamp", UInt,hDC := DllCall("GetDC", UInt,0), UInt,&GR)
Current:=NumGet(GR, 2, "UShort") - 128, DllCall("ReleaseDC", UInt,0, UInt,hDC)
Br:=(Br := Current + V) > 255 ? 255 : Br < 0 ? 0 : Br
Loop, % VarSetCapacity(GR,1536)/6
NumPut((n := (Br+128)*(A_Index-1)) > 65535 ? 65535 : n, GR, 2*(A_Index-1), "UShort")
DllCall("RtlMoveMemory", UInt,&GR+512, UInt,&GR, UInt,512)
DllCall("RtlMoveMemory", UInt,&GR+1024, UInt,&GR, UInt,512)
DllCall("SetDeviceGammaRamp", UInt,hDC := DllCall("GetDC", UInt,0), UInt,&GR)
, DllCall("ReleaseDC", UInt,0, UInt,hDC)
Shortcut: Alt-X
Type: Command
Set first line to Br:=brightness level between 0 and 255: 0=Darkest, 255=Brightest, 128 Normal
Code: Select all
Br=128 ;0-255, 128=normal
Loop, % VarSetCapacity(GR,1536)/6
NumPut((n := (Br+128)*(A_Index-1)) > 65535 ? 65535 : n, GR, 2*(A_Index-1), "UShort")
DllCall("RtlMoveMemory", UInt,&GR+512, UInt,&GR, UInt,512)
DllCall("RtlMoveMemory", UInt,&GR+1024, UInt,&GR, UInt,512)
DllCall("SetDeviceGammaRamp", UInt,hDC := DllCall("GetDC", UInt,0), UInt,&GR)
, DllCall("ReleaseDC", UInt,0, UInt,hDC)
I would love for this scrip to work for my laptop since Sony has screwed up royally and the driver that activates the brightness keys cannot even be installed. However, the script doesn't really change brightness, but gamma. Of course this is readily apparent since it uses xxxDeviceGammaRamp.
I found this: (link in the following post because this is my first one) but I'm not really conversant with HK...
I found this: (link in the following post because this is my first one) but I'm not really conversant with HK...
...and here's the link: http://www.autohotkey.com/board/topic/8 ... rightness/
Oh, and also this: http://www.autohotkey.com/board/topic/5 ... e-control/
Oh, and also this: http://www.autohotkey.com/board/topic/5 ... e-control/
Hi Gryzor and welcome to the forum. I tried the scripts in the links but unfortunately none of them work on my computer, maybe they are laptop or OS specific.
You can copy any of the AutoHotkey scripts and paste it to the txt file. Save the file as FileName.ahk to the FastKeys scripts folder. Then you can run it from any module - select Type: Script and press "Open" button to select the script.
Please let me know if you find something which works for you. If you have any question, just ask.
You can copy any of the AutoHotkey scripts and paste it to the txt file. Save the file as FileName.ahk to the FastKeys scripts folder. Then you can run it from any module - select Type: Script and press "Open" button to select the script.
Please let me know if you find something which works for you. If you have any question, just ask.